[Seaside] Swazoo web server

Janko Mivšek janko.mivsek at eranova.si
Sun Jul 22 18:20:59 UTC 2007

Hi Marteen,

Janko Mivšek wrote:

>> Can Swazoo handle 20MB downloads at the same time as continuing 
>> serving my seaside application ?
> Currently not very efficient. I just tried and it managed to download 
> 20M file with 56KB/sec (on 100MB optical line) but CPU was 100% and with 
> excessive garbage generation. Parallel wget was blocked during that 
> time. That wget otherwise got 11KB HTML file in avg 120ms (about 
> 100KB/sec) on 4M DSL line.

Well, I just made that optimization and now Swazoo can serve long files 
while serving others too. Problem was in very badly done flush to TCP 
socket, which copied a whole file everytime it sends a small chunk to 
socket. This wasn't obvious at small responses but became obvious at 
large files.

Now a 20MB file is served with about 4MB/sec on 100Mb line while 11KB 
requests are just slightly slower, about 160ms instead of 120 on 4Mb line.

But it still takes about 10s reading that file to memory and copying 
there several times and during that time server is blocked. Streaming 
will solve that problem too.

You can try by yourself: download 
http://esug2003.esug.org/vrh-oktober.tar.gz while requesting first page 

This website is served by Aida/Web static web serving but I think same 
results would be with Swazoo's own one.

This optimization will be already included in forthcoming 2.0 beta2.

Best regards

> Problem seems to be in current implementation of response sending, which 
> generates a lot of small short living arrays to send segments of data to 
> TCP socket. Not to mention that all file is read in memory and copied 
> there several times!
> I'm currently working on streaming support and just finished input 
> streaming (for file uploads). Idea is to stream files directly from/to 
> TCP sockets, without intermediate buffering in memory. After that and 
> after careful GC avoidance optimizations I'm confident that Swazoo will 
> be capable to serve such large files in parallel to serve other requests.
> Input streaming will be released in few days as Swazoo 2.0 beta2, while 
> I expect to finish output streaming soon after that too.
> Best regards
> Janko

Janko Mivšek
Smalltalk Web Application Server

More information about the Seaside mailing list