Changeset - 692dddf298e2
[Not reviewed]
default
0 2 0
Mads Kiilerich - 9 years ago 2017-01-03 02:06:41
mads@kiilerich.com
middleware: drop gzipper middleware

It added unfortunate buffering, was only enabled for static_files=true, and
isn't available for TurboGears2.

If necessary, it is better to configure the web server to provide it.
2 files changed with 14 insertions and 10 deletions:
0 comments (0 inline, 0 general)
docs/usage/performance.rst
Show inline comments
 
@@ -78,20 +78,19 @@ following:
 

	
 

	
 
Serve static files directly from the web server
 
-----------------------------------------------
 

	
 
With the default ``static_files`` ini setting, the Kallithea WSGI application
 
will take care of serving the static files found in ``kallithea/public`` from
 
the root of the application URL. While doing that, it will currently also
 
apply buffering and compression of all the responses it is serving.
 
will take care of serving the static files from ``kallithea/public/`` at the
 
root of the application URL.
 

	
 
The actual serving of the static files is unlikely to be a problem in a
 
Kallithea setup. The buffering of responses is more likely to be a problem;
 
large responses (clones or pulls) will have to be fully processed and spooled
 
to disk or memory before the client will see any response.
 
The actual serving of the static files is very fast and unlikely to be a
 
problem in a Kallithea setup - the responses generated by Kallithea from
 
database and repository content will take significantly more time and
 
resources.
 

	
 
To serve static files from the web server, use something like this Apache config
 
snippet::
 

	
 
        Alias /images/ /srv/kallithea/kallithea/kallithea/public/images/
 
        Alias /css/ /srv/kallithea/kallithea/kallithea/public/css/
 
@@ -101,12 +100,19 @@ snippet::
 

	
 
Then disable serving of static files in the ``.ini`` ``app:main`` section::
 

	
 
        static_files = false
 

	
 
If using Kallithea installed as a package, you should be able to find the files
 
under site-packages/kallithea, either in your Python installation or in your
 
under ``site-packages/kallithea``, either in your Python installation or in your
 
virtualenv. When upgrading, make sure to update the web server configuration
 
too if necessary.
 

	
 
It might also be possible to improve performance by configuring the web server
 
to compress responses (served from static files or generated by Kallithea) when
 
serving them. That might also imply buffering of responses - that is more
 
likely to be a problem; large responses (clones or pulls) will have to be fully
 
processed and spooled to disk or memory before the client will see any
 
response. See the documentation for your web server.
 

	
 

	
 
.. _SQLAlchemyGrate: https://github.com/shazow/sqlalchemygrate
kallithea/config/middleware.py
Show inline comments
 
@@ -17,13 +17,12 @@
 

	
 
from routes.middleware import RoutesMiddleware
 
from paste.cascade import Cascade
 
from paste.registry import RegistryManager
 
from paste.urlparser import StaticURLParser
 
from paste.deploy.converters import asbool
 
from paste.gzipper import make_gzip_middleware
 

	
 
from pylons.middleware import ErrorHandler, StatusCodeRedirect
 
from pylons.wsgiapp import PylonsApp
 

	
 
from kallithea.lib.middleware.simplehg import SimpleHg
 
from kallithea.lib.middleware.simplegit import SimpleGit
 
@@ -102,11 +101,10 @@ def make_app(global_conf, full_stack=Tru
 
    app = RegistryManager(app) # thread / request-local module globals / variables
 

	
 
    if asbool(static_files):
 
        # Serve static files
 
        static_app = StaticURLParser(config['pylons.paths']['static_files'])
 
        app = Cascade([static_app, app])
 
        app = make_gzip_middleware(app, global_conf, compress_level=1)
 

	
 
    app.config = config
 

	
 
    return app
0 comments (0 inline, 0 general)