Bad performance of HTTPServletResponse at Tomcat

S

Sasha

Hi ,
I have a serious bad performance problem when under the load.
When I make a load test of 20 users, I see a bottleneck on the writing
of the response.
The lenght of the message up to 50K , but writting to outputstream
takes about 40 seconds.

Thanks in advance, Sasha
 
N

navalverma

I am not sure of this, but may be increasing the size of the buffer
related to the output stream will help.
 
W

William Brogden

Hi ,
I have a serious bad performance problem when under the load.
When I make a load test of 20 users, I see a bottleneck on the writing
of the response.
The lenght of the message up to 50K , but writting to outputstream
takes about 40 seconds.

Thanks in advance, Sasha

I would bet that the problem is not in writing the output stream.
Is it reading a database?
Have you tried giving Tomcat more memory?
 
S

Sasha

Hi ,
Thanks a lot for your answers.
My servlet performs database queries and returns the answer to client.

I'm sure that it's not a DB problem since I see in the profiler that
execution time of DB queries doesn't change, and the time of writting
to OutputStream consistently grows.

In the beginning of the test with 1 user the division is 10/90 for DB
queries, and with 20 users it turns out to 80/20 to the writting to
OutputStream.

And as I said , it waits up to 40 seconds in the writting.
To my mind I need to tune Tomcat. It seems to me that the problem in
the account of descriptors that Tomcat can open , and the problem
occurs when it gets to the limit.

So if you know how to tune it , or you know the possible reason of the
problem please help me.

P.S. I would add a picture from the profiler that shows this problem,
but this forum doesn't allow to attache files.

Thanks in advance, Sasha
 
A

Andy Flowers

Sasha said:
Hi ,
Thanks a lot for your answers.
My servlet performs database queries and returns the answer to client.

I'm sure that it's not a DB problem since I see in the profiler that
execution time of DB queries doesn't change, and the time of writting
to OutputStream consistently grows.

In the beginning of the test with 1 user the division is 10/90 for DB
queries, and with 20 users it turns out to 80/20 to the writting to
OutputStream.

And as I said , it waits up to 40 seconds in the writting.
To my mind I need to tune Tomcat. It seems to me that the problem in
the account of descriptors that Tomcat can open , and the problem
occurs when it gets to the limit.

So if you know how to tune it , or you know the possible reason of the
problem please help me.

P.S. I would add a picture from the profiler that shows this problem,
but this forum doesn't allow to attache files.

Thanks in advance, Sasha

Can you post a small snippet of code which outlines your servlet logic.

Is the time to run the query including the time to loop over the resultset ?
This looping is where the time might be taken.
 
S

Sasha

I am not sure of this, but may be increasing the size of the buffer
related to the output stream will help.


Thanks a lot.
You are right - it improved the performance a little bit - now the CPU
stays on 40%, while before it was always on 100%.

I still have problems with the response time, and still sometimes this
operation takes too much time.


In addition I run the same test on WebLogic and the problem dissapeared
at all. So for sure it's a problem of Tomcat.

Do you have any additional ideas ?
 
J

Juha Laiho

Sasha said:
I have a serious bad performance problem when under the load.
When I make a load test of 20 users, I see a bottleneck on the writing
of the response.
The lenght of the message up to 50K , but writting to outputstream
takes about 40 seconds.

No help for your problem, but could you disclose the version of Tomcat
you're using?
 
J

John C. Bollinger

Sasha said:
In addition I run the same test on WebLogic and the problem dissapeared
at all. So for sure it's a problem of Tomcat.

Perhaps. If your code is poor, and Weblogic doesn't happen to be
affected as badly as Tomcat is, then is it really Tomcat's fault? It
may indeed be that Tomcat has an issue here, but you have described the
situation so generically that there is no way any of us can give you
much in the way of meaningful help. As far as I know, Tomcat does not
have any known generic problems under load.

Notwithstanding the above, one general issue that you may run into when
making a program do more work is garbage collection. If your servlet
flagrantly produces loads of garbage and maintains large data structures
in memory then you may be seeing the effect of differing maximum heap
sizes in the underlying VM, or possibly a GC strategy in Weblogic's VM
that happens to significantly outperform the one in Tomcat's VM for your
particular scenario. That's a shot in the dark.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top