Giorgi has done some helpful initial optimization work for us,
based on Nicolas Lehuen's caching recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302997
Thanks for your work, Giorgi! It clarifies for me how I would
like to proceed with optimizing Aspen, which is an important goal
for the 1.0 release. At your suggestion, I have refactored the
handlers.py module into a handlers subpackage, making it easier
to implement and test alternate handlers.
The bottom line is that static file serving is the single most
important use case for which to optimize. Let's focus all of our
1.0 optimization efforts on that. Caching is one strategy here.
However, I would prefer that we look first at PEP 333's
wsgi.file_wrapper convention, which is designed specifically for
optimized static file serving:
http://www.python.org/dev/peps/pep-0333/#optional-platform-specific-file-handling
A few issues come to mind here:
1. This properly belongs upstream from us, in wsgiserver.py.
2. On Unix, this basically requires sendfile, of which I've
found three Python implementations, none ideal:
- Medusa's is aging and non-portable
- mod_python's is specific to mod_python (yes?)
- Ben Woolley's is GPL'd
3. I'm not sure what this requires on Windows.
Additionally, I'd like to implement support for Range requests
(issue 29) alongside any static file optimizations, because that
would likewise probably require changes to wsgiserver, and
because Range requests are most useful for static file serving.
So to summarize our optimization strategy moving forward:
1. focus on static file serving
2. work with wsgi.file_input
3. coordinate with support for Range requests
chad