I’ve seen a lot of machines running both Apache with mod_jk just to redirect ports to Jboss/Tomcat or another Java application server. As most of the Java AS have a built in HTTP server and can “talk” with that protocol, I can just let them run on the web (80) port and save me the extra configuration and memory Apache needs.
While this solution works fine, we should bear some things in mind:
- This solution requires running the Java AS as root, otherwise it can’t use a port lower than 1024. Running as root have some security implications.
- This means we can’t run regular websites on the server, as everything is handled by the Java AS.
- We can’t use Apache to load balance the Java AS (if we have more than one)
- We can’t run several Java AS on the same machine.
- We usually keeps the control on the AS for the system administrator, while running the AS as a separate user lets us pass the control to someone else.
So after seeing all the disadvanteges of not using Apache and mod_kl, I decided it worth the extra configuration and memory (:
Apache’s mod_jk has nice load balancing features. They work quite well for me with Jboss. The basic configuration is to install Jboss on several machines and have an Apache to load balance them.
But while the load balancing is good, the Apache machine becomes a single point of failure. I was asked how to overcome that. The main principle I want keep is the “keep it simple, stupid” principle.
Doing a round robin DNS between two machines is nice, but doesn’t really provides real the load balancing (as it always does 50/50). It also doesn’t check for the the load before it does the balancing.
Other options like using mod_backhand and mod_proxy_balancer all leave me with the same single point of failure problem. That’s why I prefer to use an active/passive cluster to make sure Apache can move to another server in case of a failure. The IP address the users get is a virtual (or floating) IP, which can “jump” between the cluster nodes.
There are several ways to create that cluster, but that’s probably for another more general post.
I’ll be happy to hear other opinions…