9

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

Rich
  • 1,333
  • 5
  • 27
  • 39

1 Answers1

8

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.

e_tothe_ipi
  • 478
  • 2
  • 3
  • When working with Apache mod_proxy look at https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#x-headers. If you configure the RemoteIpValve as part of your Tomcat Servlet your application code can get most information transparently https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#Remote_IP_Valve – Scott Markwell Jul 29 '15 at 00:28
  • The `Host` header will get passed through correctly if you use `ProxyPreserveHost On` – Derf Jun 12 '11 at 18:08