You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jean-Jacques Clar <JJ...@novell.com> on 2005/05/13 00:34:18 UTC

[Q/PATCH] ws_write call to ap_rflush

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
ap_rflush():
http://issues.apache.org/bugzilla/show_bug.cgi?id=34589
 

Thank you very much,
 
Jean-Jacques