[Zope-Annce] New Sendfile Patch Released

Andrew Milton akm at theinternet.com.au
Fri Apr 6 04:03:01 EDT 2007

A new version with better Linux support for large files has been released. You
can get the latest version here;


This is a monkey patch, to revert, simply uninstall the Product.

There is also a patch (not a monkey patch) for ExternalFile to allow it to use
sendfile if available.

If you're serving flash, large media like images or music or large javascript 
libraries out of Zope, this might be of use to you.


Sendfile is a system call available on most UNIX(-like) systems that
efficiently copies data between two file descriptors. This patch adds a
sendfile method to the Zope Response to allow access to it.

Due to the fact it requires a file descriptor, it is only available to trusted
code, (External Methods, Products). While it's trivial to add a version that
allows you to utilise it by passing a filename, this a large security problem
out of the box, and so this method is not provided.

A writeup of how to create a simple external method to statically serve images from
a fixed directory can be found at 

For a 400K file stored as an Zope Image in the ZODB, I can expect around 30
requests a second to be fulfilled. Using the sendfile patch and an external
method or other FS serving code, this can be over 90 requests a second. At
least on my old hardware.

Andrew Milton
akm at theinternet.com.au

More information about the Zope-Announce mailing list