Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are preparing for migration from the following environment:

Apache 2.0.2 --AJP--> JBoss4.2.2

to

Apache 2.2.3 --???--> JBoss 5.1.0

How would you join the two together?

Options are:

  1. Classic AJP (means building mod_jk for Apache)
  2. mod_proxy (forwarding HTTP requests to JBoss)
  3. mod_proxy_ajp

Option 2 is the most popular solution at the moment because it seems to mean less processing due to no-longer needing to translate JBoss's responses from AJP, and CPU time is something we need to keep a close eye on in our infrastructure. Options 2 and 3 also come with the Apache build supported by Red Hat.

At the moment I can't see us going for option 1, as we get AJP 'for free' with option 3.

Therefore, what are the pros and cons of options 2 and 3? Is the concern about CPU load really something that we need to worry about? What we lose in processing binary data (AJP traffic) do we get back in reduced bandwidth and IO?

Our infrastructure will be Apache fronting up-to 9 heavily-tuned JBosses (but usually around half that) all on the same RHEL 5 machine, which is virtualised in a private cloud.

Thanks in advance for any pointers/advice.

Rich

share|improve this question

migrated from superuser.com Sep 17 '10 at 16:42

This question came from our site for computer enthusiasts and power users.

add comment

2 Answers

up vote 3 down vote accepted

2 mod_proxy_http, unless you need the Host header from the client.

I don't recommend classic mod_jk because its functionality has been replaced by mod_proxy_ajp and as you said yourself, it requires building and maintaining that module yourself.

I think mod_proxy_http is a very clean solution and it takes ajp out of the picture. However, you should be aware of a few caveats for moving from ajp to http. If you need access to the server headers exactly as they were received by apache (including the Host header), the you should use ajp. JBoss will see a fresh http request coming from apache, not the original client. If you only need the remote IP of the client, you can still get this with a special header that apache can set on the new requests. However, if you are doing virtual hosting from the application layer, you're better off with ajp.

As far as performance is concerned, either ajp or http will require some processing by JBoss and some local socket TCP traffic. You'll have to try both to see which is more efficient, but I think overall it's a very small percentage of the total server load. Http is a more complicated protocol and ajp is specifically designed to efficiently between web and app tiers, so theoretically ajp is probably better. That said, I have found that http is often better supported outside of the Tomcat app server line.

I use mod_proxy_ajp and mod_proxy_http and I have had no problems whatsoever.

share|improve this answer
add comment

The Host header will get passed through correctly if you use ProxyPreserveHost On

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.