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/17 01:10:22 UTC

Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

re-sending :
Am I missing details?
 
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


>>> mturk@apache.org 5/16/2005 1:57 AM >>>
Hi,

JK 1.2.13 has been taggeded as we agreed last week,
and the tarballs are available at:
http://www.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-1.2.13/
For those that don't have WIN32 compiler there is a set of binaries at:
http://www.apache.org/dist/jakarta/tomcat-connectors/jk/binaries/win32/

Please test as much as possible since we'll be aiming towards 1.2.14
stable by simply rettaging if no bugs are present. In case they are, we
can made few 1.2.14-rc-xx versions, as we done with 1.2.7.

Further more, as agreed, we'll froze the 1.2 branch and only
do a bug fixing, so please don't add any new features to that branch.

Regards,
Mladen.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org




Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Henri Gomez wrote:
> good idea.
> 
> Which state by default ?

off (-FlushPackets).

> 
> 2005/5/18, jean-frederic clere <jf...@fujitsu-siemens.com>:
> 
>>Mladen Turk wrote:
>>
>>>jean-frederic clere wrote:
>>>
>>>
>>>>Mladen Turk wrote:
>>>>
>>>>I think on/off is enough - Think of the questions nnn will bring in
>>>>user list -
>>>>
>>>
>>>So how about to just add the flag to JkOptions like +FlushPackets?
>>
>>+1.
>>
>>
>>>Regards,
>>>Mladen.
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by Henri Gomez <he...@gmail.com>.
good idea.

Which state by default ?

2005/5/18, jean-frederic clere <jf...@fujitsu-siemens.com>:
> Mladen Turk wrote:
> > jean-frederic clere wrote:
> >
> >> Mladen Turk wrote:
> >>
> >> I think on/off is enough - Think of the questions nnn will bring in
> >> user list -
> >>
> >
> > So how about to just add the flag to JkOptions like +FlushPackets?
> 
> +1.
> 
> >
> > Regards,
> > Mladen.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Mladen Turk wrote:
> jean-frederic clere wrote:
> 
>> Mladen Turk wrote:
>>
>> I think on/off is enough - Think of the questions nnn will bring in 
>> user list -
>>
> 
> So how about to just add the flag to JkOptions like +FlushPackets?

+1.

> 
> Regards,
> Mladen.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by Mladen Turk <mt...@apache.org>.
jean-frederic clere wrote:
> Mladen Turk wrote:
> 
> I think on/off is enough - Think of the questions nnn will bring in user 
> list -
>

So how about to just add the flag to JkOptions like +FlushPackets?

Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Mladen Turk wrote:
> jean-frederic clere wrote:
> 
>>>
>>> Not sure what you mean by that. Like a generic callback?
>>
>> Yes to able to flush the same way we write.
>>
> 
> OK, makes sense.
> 
>>>
>>> If 'JkFlush Off' is used a single ap_rflush will be issued
>>> when all the data is send.
>>
>>
>> Then why not using 'JkFlush Off' as default behaviour?
>>
> 
> That makes sense too.
> How about using only 'JkFlush nnn' where nnn is the number
> of AJP packets. So JkFlush 1 will have the exact behavior like
> now. Default (0) will call a single ws_write() after all the
> data has been send.

I think on/off is enough - Think of the questions nnn will bring in user list -

> 
> Regards,
> Mladen.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by Mladen Turk <mt...@apache.org>.
jean-frederic clere wrote:
>>
>> Not sure what you mean by that. Like a generic callback?
> Yes to able to flush the same way we write.
>

OK, makes sense.

>>
>> If 'JkFlush Off' is used a single ap_rflush will be issued
>> when all the data is send.
> 
> Then why not using 'JkFlush Off' as default behaviour?
>

That makes sense too.
How about using only 'JkFlush nnn' where nnn is the number
of AJP packets. So JkFlush 1 will have the exact behavior like
now. Default (0) will call a single ws_write() after all the
data has been send.

Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Mladen Turk wrote:
> jean-frederic clere wrote:
> 
>> Mladen Turk wrote:
>>
>>>
>>> JkFlush (On|Off|size) with On as default for each packet write.
>>> That way we'd be able to flush after each write, flush after each
>>> 'size' bytes or not flush at all.
>>>
>>
>> Won't it be better to have a ws_flush()?
>>
> 
> Not sure what you mean by that. Like a generic callback?

Yes to able to flush the same way we write.

> Not sure if it would make sense. IIS for example does
> auto flushing, so It's only needed for Apache2.
> Having 'JkFlush size' like 'JkFlush 65536' will insert
> an EOS bucket after 64K. Having large chunks might make
> problems to outgoing filters like deflate, that depends
> on EOS bucket for compressing window size.
> 
> Right now the chunk size is AJP packet size (8K) that
> might cause memory problems like JJC said.

yep.
(write(8K) + flush())*n is not ok.
(write(8K)*n + flush() is the right thing.

> Adding that as configurable server wide option will not break
> exiting behavior, while it might speed up large data transfer,
> and keep the memory low.
> 
> If 'JkFlush Off' is used a single ap_rflush will be issued
> when all the data is send.

Then why not using 'JkFlush Off' as default behaviour?

> 
> 
> Regards,
> Mladen.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by Mladen Turk <mt...@apache.org>.
jean-frederic clere wrote:
> Mladen Turk wrote:
>>
>> JkFlush (On|Off|size) with On as default for each packet write.
>> That way we'd be able to flush after each write, flush after each
>> 'size' bytes or not flush at all.
>>
> 
> Won't it be better to have a ws_flush()?
>

Not sure what you mean by that. Like a generic callback?
Not sure if it would make sense. IIS for example does
auto flushing, so It's only needed for Apache2.
Having 'JkFlush size' like 'JkFlush 65536' will insert
an EOS bucket after 64K. Having large chunks might make
problems to outgoing filters like deflate, that depends
on EOS bucket for compressing window size.

Right now the chunk size is AJP packet size (8K) that
might cause memory problems like JJC said.
Adding that as configurable server wide option will not break
exiting behavior, while it might speed up large data transfer,
and keep the memory low.

If 'JkFlush Off' is used a single ap_rflush will be issued
when all the data is send.


Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Mladen Turk wrote:
> Jean-Jacques Clar wrote:
> 
>> re-sending :
>> Am I missing details?
>>  
>> 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.
>>
> 
> Seems we are the only module out there that calls the apr_rflush in
> Apache2.
> Althought I said 'no more features' I propose that we make a config
> option that will be in the form of:
> 
> JkFlush (On|Off|size) with On as default for each packet write.
> That way we'd be able to flush after each write, flush after each
> 'size' bytes or not flush at all.
> 
> How that sounds?

Won't it be better to have a ws_flush()?

> 
> Regards,
> Mladen.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK 1.2.13 TAGGED - ws_write call to ap_rflush in mod_jk.c

Posted by Mladen Turk <mt...@apache.org>.
Jean-Jacques Clar wrote:
> re-sending :
> Am I missing details?
>  
> 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.
>

Seems we are the only module out there that calls the apr_rflush in
Apache2.
Althought I said 'no more features' I propose that we make a config
option that will be in the form of:

JkFlush (On|Off|size) with On as default for each packet write.
That way we'd be able to flush after each write, flush after each
'size' bytes or not flush at all.

How that sounds?

Regards,
Mladen.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org