Shane Hathaway wrote:
Here's a better alternative: when you can, avoid caching altogether. For example, if you're storing files using Ape, stream the data directly to/from the filesystem. In fact, when sending a file, the server could close the database connection, freeing up precious database threads, and let asyncore stream the rest of the data from the file.
To do this, we'd need minimal support from the application. OFS.File needs to delegate the specifics of data storage and retrieval to a subobject. Ape could take the opportunity to replace that subobject with something that reads and writes the file directly.
Maybe this could include the possibility to not serve the file via ZServer at all. I did a small patch to ExtFile for that. If the file object is accessed via zope, it returns a redirect to a computed location where then the file is served from apache. I think there are a lot of use cases for that, even if ZServer's performance isn't considerably worse than e.g. apache's. You might want to stream multimedia files with a streaming server but manage them in zope, there might be cases when ZServer's http implementation is not up to the task, as it was with pdf a while ago IIRC. Maybe this would also help with certain quirks in some WebDAV implementations where apache might have a workaround, but ZServer has not (yet). cheers, oliver