tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Jacques Clar" <>
Subject [Q/PATCH] ws_write call to ap_rflush
Date Thu, 12 May 2005 22:34:18 GMT
Calling ap_rflush() at the end of ws_write() in mod_jk.c is causing me 
problems when doing downloads from the server to a client.
Performance degradation and, less importantly, memory usage,  are the problems.
During calls to ap_rwrite() in ws_write, a brigade is created and
used to move data. When done, a call to apr_brigade_destroy()
is made. A call to apr_pool_cleanup_kill() ensures that the registered 
cleanup entry is removed  from the cleanups linked list associated 
with the request pool. The brigade is then cleaned up.
After that, a call is done to ap_rflush() within ws_write to do what seems to me
the same operations that were just made. ap_rflush is also creating a brigade
on every call and adds its cleanup function to the cleanups list. 
The brigades created by ap_rflush will not be destroyed before the
request is finished, if I understand correctly. 
ap_rflush job is to destroy the brigade created by the ap_rwrite
operation, which was already done and removed from the cleanups
list previously. In my test, at the beginning of a download, mod_jk is doing 
about 250 calls to ap_rflush() every seconds. This is when the cleanups list 
is of reasonable size, gets much slower quickly because of the time spent 
scanning the cleanups list. 
I am downloading large files (> 1GB), it takes time and
by the time I get to the end of the download, my cleanups list has grow
to over 200000 members and it has to be scanned unsuccessfully from beginning to
end in search of a brigade that was previously removed.
Removing the call to ap_rflush() is working great for me:
I ran stress and functional testing on my server w/ no apparent problems.
My question are:
Why is ws_write() calling ap_rflush()? I am sure other users are suffering from it. 
Could it be just removed?
If it is essential, any suggestions for a workaround for my problem?
This is a link to a bug that is related to the extra brigade created by

Thank you very much,

View raw message