Home arrow BrainDump arrow Page 4 - Benchmarking Tomcat Performance

Building the APR Connector - BrainDump

In this second part of a five-part article series on Tomcat performance tuning, you will learn how to do benchmarks so you can see what effects your changes produced. It is excerpted from chapter four of Tomcat: The Definitive Guide, Second Edition, written by Jason Brittain and Ian F. Darwin (O'Reilly; ISBN: 0596101066). Copyright © 2008 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

TABLE OF CONTENTS:
  1. Benchmarking Tomcat Performance
  2. Web Server Performance Comparison
  3. Benchmarked hardware and software configurations
  4. Building the APR Connector
By: O'Reilly Media
Rating: starstarstarstarstar / 3
February 19, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
 

We built the APR connector like this:

  # CFLAGS="-O3 -falign-functions=0 -march=athlon64 -mfpmath=sse -mmmx -msse -msse2 -
  msse3 -m3dnow -mtune=athlon64" ./configure --with-apr=/usr/bin/apr-1-config --
  prefix=/opt/tomcat/apr-connector
  # make && make install

We used the sameCFLAGS when building Apache httpd and mod_jk. Hereís how we built and installed mod_jk:

  # cd tomcat-connectors-1.2.20-src/native
  # CFLAGS="-O3 -falign-functions=0 -march=athlon64 -mfpmath=sse -mmmx -msse -msse2 -
  msse3 -m3dnow -mtune=athlon64" ./configure --with-apxs=/opt/httpd/bin/apxs
 
[lots of configuration output removed]
 
# make && make install

This assumes that the root directory of the Apache httpd we built is /opt/httpd.

We built the APR connector, httpd, and mod_jk with GCC 4.1.1:

  # gcc --version
  gcc (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30)
  Copyright (C) 2006 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions. There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

We downloaded Apache httpd version 2.2.3 from http://httpd.apache.organd built it two different ways and benchmarked each of the resulting binaries. We built it for prefork MPM and worker MPM. These are different multithreading and multiprocess models that the server can use. Here are the settings we used for prefork and worker MPM:

  # prefork MPM
  <IfModule prefork.c>
 
StartServers       8
  MinSpareServers    5
  MaxSpareServers   20
  ServerLimit      256
  MaxClients       256
  MaxRequestsPerChild 4000
  </IfModule>

  # worker MPM
  <IfModule worker.c>
  StartServers         3
  MaxClients         192
  MinSpareThreads      1
  MaxSpareThreads     64
  ThreadsPerChild     64
  MaxRequestsPerChild  0
  </IfModule>

We disabled Apache httpdís common access log so that it would not need to log anything per each request (just as we configured Tomcat). And, we turned on Apache httpdísKeepAliveconfiguration option:

  KeepAlive On
  MaxKeepAliveRequests 100
  KeepAliveTimeout 5

We enabled mod_proxy one of two ways at a time. First, for proxying via HTTP:

ProxyPass /tc http://127.0.0.1:8080/

ProxyPassReverse /tc http://127.0.0.1:8080/

Or, for proxying via AJP:

  ProxyPass        /tc ajp://127.0.0.1:8009/
  ProxyPassReverse /tc ajp://127.0.0.1:8009/

And, we configured mod_jk by adding this to httpd.conf:

LoadModule jk_module /opt/httpd/modules/mod_jk.so

JkWorkersFile /opt/httpd/conf/workers.properties

JkLogFile /opt/httpd/logs/mod_jk.log

JkLogLevel info

JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

JkRequestLogFormat "%w %V %T"

JkMount /tc/* worker1

Plus we created a workers.properties file for mod_jk at the path we specified in the httpd.conffile:

  worker.list=worker1 
  worker.worker1.type=ajp13
  worker.worker1.host=localhost
  worker.worker1.port=8009
  worker.worker1.connection_pool_size=150
  worker.worker1.connection_pool_timeout=600
  worker.worker1.socket_keepalive=1

Of course, we enabled only one Apache httpd connector module at a time in the configuration.

Please check back next week for the continuation of this article.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

BRAINDUMP ARTICLES

- Apple Founder Steve Jobs Dies
- Steve Jobs` Era at Apple Ends
- Google's Chrome Developer Tool Updated
- Google's Chrome 6 Browser Brings Speed to th...
- New Open Source Update Fedora 13 is Released...
- Install Linux with Knoppix
- iPad Developers Flock To SDK 3.2
- Managing a Linux Wireless Access Point
- Maintaining a Linux Wireless Access Point
- Securing a Linux Wireless Access Point
- Configuring a Linux Wireless Access Point
- Building a Linux Wireless Access Point
- Migrating Oracle to PostgreSQL with Enterpri...
- Demystifying SELinux on Kernel 2.6
- Yahoo and Microsoft Create Ad Partnership

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: