Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Apache httpd to Tomcat - jk v proxy
Many of our customers run both the Apache httpd and Apache Tomcat web servers - with good cause, since Tomcat is biased towards web applications where the same code is run many, many times over and httpd is biased towards serving pages and is better tuned for a much larger number of different pages but at a somewhat less frequent interval.

But the user (via browser) wants a single point of contact - typically httpd - with a number of mechanisms used to link the two servers. Jserv, mod_jk2 and warp are all deprecated, mod_rewrite can be used, but the most common link is done through httpd's mod_jk or mod_proxy modules. Historically, mod_proxy has been much easier to set up but has had a reputation for being much slower. Link - "The Connector Story"

Is mod_proxy's reputation for being slow deserved? How DO the speeds compare? The questions were asked during last week's deployment course in Glasgow and I thought I would - my first clear day - do some experiments to find out.

I set up a server (Linux, Fedora core 3, Apache 2, Tomcat 5.5) and set up both jk and proxy connections between them. I also set up an httpd alias to allow a direct httpd access to a web application, and an http connector on Tomcat to allow direct access via that server. I then benchmarked a plain HTML file of 1k in size, using the ab tool to load the page 1000 times in quick succession in four different ways.

ab -n1000 http://snowdrop:8080/latmjdemo/index.html > tomcat
ab -n1000 http://snowdrop/direct/index.html > httpd
ab -n1000 http://snowdrop/latmjdemo/index.html > jk
ab -n1000 http://snowdrop/felix/index.html > proxy

Running the test on a quiet network five times, with the ab commands running in a different order to balance out any caching issues, I got the following:

Direct access via httpd - 300 per second
Direct access via Tomcat - 483 per second
Access via both servers connected by jk - 307 per second
Access via both servers connected by proxy - 222 per second

What I expected? No, to be honest I was surprised that the direct access via httpd was so slow compared to the others. But then thinking it through, Tomcat is a great CACHEING server so it will perform proportionately far better on a test such as this that repeatedly hits the same page.

I was also pleasantly surprised to see that proxy was less that 30% slower than jk - I feared much worse. And thinking through the benchmark I ran, serving an html page is likely to be one of the data types that shows up the difference too - there's no gobs of Java code to be run to dilute the protocol time.

Conclusion? If you want every ounce of performance from your httpd / Tomcat pair, use jk. If you're not pushing it to the limit, then proxy's likely to be fine for you.
(written 2006-03-03 13:35:28)

 
Associated topics are indexed under
A655 - Web Application Deployment - Using Tomcat and Apache httpd Together
A657 - Web Application Deployment - Using httpd to front Tomcat
A603 - Web Application Deployment - Further httpd Configuration

Back to
Hostnames spring forward
Previous and next
or
Horse's mouth home
Forward to
Moral dilemma

Some other Articles
Odd one out.
Real chance to make a difference
Copying a reference, or cloning
Moral dilemma
Apache httpd to Tomcat - jk v proxy
Hostnames spring forward
Choosing the right language
Active Learning
JIT or JAU
Not just a pretty face to answer the phone.
1638 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho