Bad performance of HTTPServletResponse at Tomcat

Discussion in 'Java' started by Sasha, Apr 4, 2005.

  1. Sasha

    Sasha Guest

    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
    Sasha, Apr 4, 2005
    #1
    1. Advertising

  2. Sasha

    steepyirl Guest

    Can you be a little more specific? What does your servlet/jsp do?
    steepyirl, Apr 4, 2005
    #2
    1. Advertising

  3. Sasha

    Guest

    I am not sure of this, but may be increasing the size of the buffer
    related to the output stream will help.
    , Apr 4, 2005
    #3
  4. On 4 Apr 2005 06:39:12 -0700, Sasha <> wrote:

    > 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?


    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
    William Brogden, Apr 4, 2005
    #4
  5. Sasha

    Sasha Guest

    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
    Sasha, Apr 5, 2005
    #5
  6. Sasha

    Andy Flowers Guest

    Sasha wrote:
    > 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.
    Andy Flowers, Apr 5, 2005
    #6
  7. Sasha

    Sasha Guest

    wrote:
    > 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 ?
    Sasha, Apr 10, 2005
    #7
  8. Sasha

    Juha Laiho Guest

    "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?
    --
    Wolf a.k.a. Juha Laiho Espoo, Finland
    (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    "...cancel my subscription to the resurrection!" (Jim Morrison)
    Juha Laiho, Apr 10, 2005
    #8
  9. Sasha wrote:

    > 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.

    --
    John Bollinger
    John C. Bollinger, Apr 11, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Landis

    HttpServletResponse.sendError

    Mike Landis, Aug 8, 2003, in forum: Java
    Replies:
    1
    Views:
    4,365
    Dave Miller
    Aug 9, 2003
  2. Joerg Mueller-Tolk
    Replies:
    2
    Views:
    1,008
    Joerg Mueller-Tolk
    Dec 3, 2003
  3. Naresh Agarwal
    Replies:
    0
    Views:
    421
    Naresh Agarwal
    May 28, 2004
  4. Naresh Agarwal
    Replies:
    1
    Views:
    1,049
    ExGuardianReader
    May 29, 2004
  5. rantingrick
    Replies:
    44
    Views:
    1,204
    Peter Pearson
    Jul 13, 2010
Loading...

Share This Page