Boost Tomcat performance for static content
PippoProxy offers an alternative to standard Apache-Tomcat implementations
By Gino Tesei, JavaWorld.com, 02/28/05
Protecting corporate internal networks from hackers, thieves, or high load traffic is a common concern. A typical security
measure consists of placing an intermediary Web server, known as an HTTP(S) proxy server, between the Internet and the internal network for controlling access. Such an intermediary Web server forwards HTTP(S) requests
from clients to other servers, making those requests look like they originated from the proxy server and vice versa (reverse
proxy).
Malicious users or excessive traffic load are just two good reasons for controlling access to internal servers. More generally,
they are two application scenarios of the well-known structural design pattern Proxy, or Surrogate, whose intent, according to the Gang of Four, (GoF) is to "provide a surrogate or placeholder for another object to control access to it." Obviously such a surrogate
adds a cost in terms of complexity. Complex systems are more difficult to understand and any modification is made harder by added complexity. So, why should
we pay such a complexity fee? Typical reasons are:
- Performance: You will eventually have to provide temporary cached instances of resources to multiple clients that share them (Cache Proxy
design pattern). For example, this approach makes sense for static content (images, Javascripts, Cascading Style Sheets, static
HTML pages).
- Security: You will eventually have to control access to resources (Protection Proxy). Typically, the proxy server is placed outside
the main corporate firewall in the so-called demilitarized zone, while proxied servers are placed inside the firewall in the
so-called militarized zone. Furthermore, you will eventually have to provide clients with different levels of access (Protection
Access Proxy). For instance, in banking applications, clients may have different levels of access to financial reports.
- Scalability: As traffic load increases, you will eventually have to add more application servers to maintain good performance, or you
might need some kind of automatic failover in case one of the nodes breaks.
- Audit: You will eventually have to count the number of accesses or trace access details to requested references (Smart Reference
Proxy). For instance, this approach is common in banner advertising applications.
When such complexity is necessary in an application, PippoProxy, a Java HTTP proxy designed and implemented for Tomcat, can
be used in place of standard Apache-Tomcat solutions. This article presents the rationale behind the development of PippoProxy,
the need for this type of proxy, and its advantages over more traditional proxies. In addition, PippoProxy's typical deployment
scenarios and comparison benchmarks to more traditional solutions are presented.
Typical Apache-Tomcat proxy configurations
The standard Apache-Tomcat proxy configuration places an Apache (proxy) HTTP server before the Tomcat application servers
in a "neutral zone" between the company's private network and the Internet (or some other outside public network) for secure
access to the company's private data. This proxy server also acts as a load balancer and as a server of static content. Figure
1 shows such a configuration scenario.
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Next >
Discuss
Start a new discussion or jump into one of the threads below:
Resources
- PippoProxy homepage
http://sourceforge.net/projects/pippoproxy/
- Tomcat homepage
http://jakarta.apache.org/tomcat/
- Proxy Support How-To
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/proxy-howto.html
- Ant homepage
http://ant.apache.org/
- HTTPClient homepage
http://www.innovation.ch/java/HTTPClient/
- Design PatternsElements of Reusable Object-Oriented Sofware, E. Gamma, R. Helm, R. Johnson, J. Vlissides (Addison-Wesley Professional, 1995; ISBN0201633612)
http://www.amazon.com/exec/obidos/ASIN/0201633612/javaworld
- For Ephemeral Cache Item, see "Chapter 7, Concurrency Patterns" in Java Enterprise Design Patterns, Volume 3, Mark Grand (John Wiley & Sons, 2002; ISBN0471333158)
http://www.amazon.com/exec/obidos/ASIN/0471333158/javaworld
- "High Availability Tomcat," Graham King (JavaWorld, December 2004)
http://www.javaworld.com/javaworld/jw-12-2004/jw-1220-tomcat.html
- Best practices for fronting Tomcat with Apache or IIS"Fronting Tomcat," Mladen Turk
http://www.apache.org/~mturk/docs/article/ftwai.html
- Tomcat FAQ about connectors
http://jakarta.apache.org/tomcat/faq/connectors.html
- The Apache Jakarta Tomcat Connector
http://jakarta.apache.org/tomcat/connectors-doc/
- "URL Rewriting Guide," Ralf S. Engelschall (December 1997)
http://httpd.apache.org/docs-2.0/misc/rewriteguide.html
- Visit Wikipedia for the Law of Demeter
http://en.wikipedia.org/wiki/Law_of_Demeter
- Visit Wikipedia for the principle of locality
http://en.wikipedia.org/wiki/Principle_of_locality
- For an introduction to extreme programming, read the bible by Kent BeckExtreme Programming Explained (Addison-Wesley Professional; 1999ISBN0201616416)
http://www.amazon.com/exec/obidos/ASIN/0201616416/javaworld
- For more articles on performance, browse the Performance Tuning section of JavaWorld's Topical Index
http://www.javaworld.com/channel_content/jw-performance-index.shtml
- For more articles on Java development tools, browse the Development Tools section of JavaWorld's Topical Index
http://www.javaworld.com/channel_content/jw-tools-index.shtml
- For more articles on design patterns, browse the Design Patterns section of JavaWorld's Topical Index
http://www.javaworld.com/channel_content/jw-patterns-index.shtml