Created by Rocael Hernández Rizzardini, last modified by Gustaf Neumann 24 Nov 2008, at 03:23 PM
In order to speed up file-deliveries, one can use the background delivery methods provided by xotcl-core. The main advantage is that with background delivery the costly connection threads are just used for permission checking and locating the file, and the time-consuming spooling of the file to the client is implemented in an asynchronous background delivery thread. Therefore, connection thread are not blocked, it is possible to spool simultaneously several hundred (thousand?) files with only a few connection threads configured.
We use this in production since several years. For example today (no semester yet) we had so far 150.000 file deliveries by background delivery.
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
http://media.wu-wien.ac.at/download/aolserver-nsd-conn.patch , or
- aolserver 4.5.0
The patch is already included in the current head version of aolserver 4.5 and in naviserver.
With this patch and xotcl-core, one can replace
ns_returnfile 200 $mime_type $filename
ad_returnfile_background 200 $mime_type $filename
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.
Check the files that has been served since the last reboot of your aolserver using this method from the developer support shell: