« Jboss: Setting Up Log Rotation | Main | Interesting DevCentral Post »


mod_jk vs. mod_proxy - connectivity options

It seems that based on the data from my server logs, "mod_jk vs. mod_proxy" is a popular search topic. Since all my visitors are shy and don't comment, I'm not sure if the introductory post on this topic I published a few months ago really provides any help on this. Therefore, I think a few more posts to flesh out the topic further might be in order. In this part, I'll describe some of the upstream connectivity options you get with mod_jk and mod_proxy to help you decide whether one is preferable over the other.

First off, these posts assume that you are using apache 2.2 and preferably apache 2.2.9, since this release fixed a lot of mod_proxy-related problems, If I remember correctly, I think that apache 2.2 was the first release that stated that mod_proxy was now considered ready for production deployments.

mod_jk only has one kind of connectivity protocol option, which is ajp. ajp is a binary protocol and ajp connections are very fast. If your back end/upstream application server does not provide an ajp/jk connector (like tomcat, jboss, jetty, and glassfish do), then you are not going to get much use out of mod_jk.

mod_proxy, on the other hand, has four different types of connection options, plus a fifth option that allows you to set up load-balanced clusters of nodes. There is a connector for ftp, one for http, one for ajp, and one for when your backend system is an ssl encrypted (https) session. So, if your backend application server does not support jk connections, you can use mod_proxy_http. Both mod_proxy-balancer and mod_proxy_ajp are new to apache 2.2

The one most prevalent in use by me right now is mod_jk. That's because mod_jk is very well documented and because I have a bunch of apache 2.0-based sites. I've been experimenting with mod_proxy_balancer load-balancing but I personally don't find it to be all that well documented yet. For example, setting up a mod_proxy_balancer configuration that utilizes ajp to connect to backend systems that support it is rather difficult and confusing in relation to setting up mod_jk to do the same thing.

That being said, http is more than likely going to be much faster than ajp with tomcat 6 and jetty (and due to the relationship between these and the open source application servers jboss, glassfish, geronimo, etc), mod_proxy_balancer over mod_proxy_http seems to be the configuration that will result in the best performance. This is due to the phenomenal performance improvements to the http connectors within these containers. As an added bonus with this configuration, the systems administrator gains the ability to run a network trace live during a problem and get a readable trace, which you won't get with an ajp connection. Apache routing traffic through mod_proxy_balancer to http application server backends will be my configuration of choice moving forward and as the older sites are upgraded, I will be looking to migrate them to this configuration as well--with the usual caveat being if a particular web application is making use of something like replication domains or something cool like that.


TrackBack URL for this entry:

Listed below are links to weblogs that reference mod_jk vs. mod_proxy - connectivity options: