Boost your application performance to serve large files!

Gustaf: For handling the file-deliveries, i would recommend the background file delivery based on libthread, which does not block connection threads.

We use this in production since more than one year. For example today (no semester yet) we had so far 150.000 file deliveries.

The asynchrounous background delivery requires a small patch (2 changes, one is a backport from naviserver) and the tcl thread library (by zoran). The application code is in XOTcl is only a few lines of code and is included in xotcl-core (bgdelivery-procs.tcl).

One needs the following patch to aolserver 4.0.10

with this patch and xotcl-core, you can replace

ns_returnfile 200 $mime_type $filename


ad_returnfile_background 200 $mime_type $filename

e.g. in cr_write_content in acs-content-repository/tcl/revision-procs.tcl
to activate it and to deliver files from the content-repository (file-store) in the background.

The connection thread is only used for permission management, localization of the file and writing the the reply header, the actual delivery of the file is performed via asychronous io without using up many resources. This can handle probably a couple of thousand concurrent file deliveries without running out of resources.

Original thread:

Contributed by Gustaf Neumann