BrainDump
  Home arrow BrainDump arrow Page 3 - Tomcat Performance Tuning
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
BRAINDUMP

Tomcat Performance Tuning
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2009-02-12


    Table of Contents:
  • Tomcat Performance Tuning
  • Measuring Web Server Performance
  • ab: The Apache benchmark tool
  • Siege

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Tomcat Performance Tuning - ab: The Apache benchmark tool
    ( Page 3 of 4 )

    The ab  tool takes a single URL and requests it repeatedly in as many separate threads as you specify, with a variety of command-line arguments to control the number of times to fetch it, the maximum thread concurrency, and so on. A couple of nice features include the optional printing of progress reports periodically and the comprehensive report it issues.

    Example 4-1 is an example running ab. We instructed it to fetch the URL 100,000 times with a maximum concurrency of 149 threads. We chose these numbers carefully. The smaller the number of HTTP requests that the test client makes during the benchmark test, the more likely the test client will give less accurate results because during the benchmark the Java VM’s garbage collector pauses make up a higher percentage of the total testing time. The higher the total number of HTTP requests that you run, the less significant the garbage collector pauses become and the more likely the benchmark results will show how Tomcat performs overall. You should benchmark by running a minimum of 100,000 HTTP requests. Also, you may configure the test client to spawn as many client threads as you would like, but you will not get helpful results if you set it higher than the maxThreads you set for your Connector in your Tomcat’s conf/server.xml file. By default, it is set to 150 . If you set your tester to exceed this number and make more requests in more threads than Tomcat has threads to receive and process them, performance will suffer because some client request threads will always be waiting. It is best to stay just under the number of your Connector ’s maxThreads , such as using 149 client threads.

    Example 4-1. Benchmarking with ab

    $ ab -k -n 100000 -c 149 http://tomcathost:8080
    This is ApacheBench, Version 2.0.40-dev <$Revision$> apache-2.0
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

    Benchmarking tomcathost (be patient) Completed 10000 requests
    Completed 20000 requests
    Completed 30000 requests
    Completed 40000 requests
    Completed 50000 requests
    Completed 60000 requests
    Completed 70000 requests
    Completed 80000 requests
    Completed 90000 requests
    Finished 100000 requests

    Server Software:           Apache-Coyote/1.1
    Server Hostname:           tomcathost
    Server Port:               8080

    Document Path:             /
    Document Length:           8132 bytes

     

     

    Concurrency Level:         149
    Time taken for tests:      19.335590 seconds Complete requests:         100000
    Failed requests:           0
    Write errors:              0
    Keep-Alive requests:       79058
    Total transferred:         830777305 bytes HTML transferred:          813574072 bytes Requests per second:       5171.81 [#/sec] (mean)
    Time per request:          28.810 [ms] (mean)
    Time per request:          0.193 [ms] (mean, across all concurrent
    requests)
    Transfer rate:             41959.15 [Kbytes/sec] received

     

    Connection Times (ms)

    min

    mean[+/-sd] median

    max

    Connect:

    0

    1

    4.0

    0

    49

    Processing:

    2

    26

    9.1

    29

    62

    Waiting:

    0

    12

    6.0

    13

    40

    Total:

    2

    28

    11.4

    29

    65

    Percentage of the requests served within a certain time (ms)
      50%     29
      66%     30
      75%     31
      80%     45
      90%     47
      95%     48
      98%     48
      99%     49
     
    100%     65 (longest request)

    If you leave off the -k in the ab command line, ab will not use keep-alive connections to Tomcat, which is less efficient because it must connect a new TCP socket to Tomcat to make each HTTP request. The result is that fewer requests per second will be handled, and the throughput from Tomcat to the client (ab ) will be smaller (see Example 4-2).

    Example 4-2. Benchmarking with ab with keep-alive connections disabled

    $ ab -n 100000 -c 149 http://tomcathost:8080/
    This is ApacheBench, Version 2.0.40-dev <$Revision$> apache-2.0
    Copyright 1996 Adam Twiss, Zeus Technology Ltd,
    http://www.zeustech.net/
    Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

    Benchmarking tomcathost (be patient) Completed 10000 requests
    Completed 20000 requests
    Completed 30000 requests
    Completed 40000 requests
    Completed 50000 requests
    Completed 60000 requests
    Completed 70000 requests
    Completed 80000 requests
    Completed 90000 requests
    Finished 100000 requests

     

    Server Software:        Apache-Coyote/1.1
    Server Hostname:        tomcathost
    Server Port:            8080


    Document Path:          /
    Document Length:        8132 bytes

     

    Concurrency Level:      149
    Time taken for tests:   28.201570 seconds Complete requests:      100000
    Failed requests:        0
    Write errors:           0
    Total transferred:      831062400 bytes
    HTML transferred:       814240896 bytes Requests per second:    3545.90 [#/sec] (mean)
    Time per request:       42.020 [ms] (mean) Time per request:       0.282 [ms] (mean, across all concurrent
    requests)
    Transfer rate:          28777.97 [Kbytes/sec] received

    Connection Times (ms)

    min mean[+/-sd] median max
    Connect: 0 18 11.3 19 70
    Processing: 3 22 11.3 22 73
    Waiting: 0 13 8.4 14 59
    Total: 40 41 2.4 41 73

    Percentage of the requests served within a certain time (ms)
      50%     41
      66%     41
      75%     42
      80%     42
      90%     43
      95%     44
      98%     46
      99%     55
     100%     73 (longest request)



     
     
    >>> More BrainDump Articles          >>> More By O'Reilly Media
     

       

    BRAINDUMP ARTICLES

    - Migrating Oracle to PostgreSQL with Enterpri...
    - Demystifying SELinux on Kernel 2.6
    - Yahoo and Microsoft Create Ad Partnership
    - The Advantages of Obscure Open Source Browse...
    - Dell Announces CSI-style Digital Forensics S...
    - Milepost GCC Speeds Open-Source Development
    - Learn These 10 Programming Languages
    - Tomcat Capacity Planning
    - Internal and External Performance Tuning wit...
    - Tomcat Benchmark Procedure
    - Benchmarking Tomcat Performance
    - Tomcat Performance Tuning
    - Wubi: Windows-based Ubuntu Installer
    - Configuring and Optimizing Your I/O Scheduler
    - Linux I/O Schedulers





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek