JBoss 7, jvmRoute and mod_proxy_balancer

Categories Development, Java

Switching to JBoss 7 changed a lot of things in how we build our applications, how we deploy them and how we manage them, mostly improving everything.

For me one of the biggest improvements in terms of increasing productivity and manageability is the new configuration system… simplified bliss.

One example is setting up the web container for balancing via mod_proxy_balancer.

In the past, this meant modifying the embedded tomcat connector… a primitive, ugly, dirty way of doing things 🙂
In AS 7, you just have to modify the $JBOSS_HOME/standalone/configuration/standalone.xml configuration file and include a system-properties config, directly under the server tag, just like this:

<system-properties>
<property name="jvmRoute" value="httpNode1"/>
</system-properties>

On the other side of the equation, the mod_proxy_balancer config lists the jvmRoute in the classic way:


ProxyPass /app balancer://mycluster/ stickysession=JSESSIONID|jsessionid scolonpathdelim=On nofailover=off

ProxyPassReverse /app http://172.16.10.10:8080/app
ProxyPassReverse /app http://172.16.10.20:8080/app

BalancerMember http://172.16.10.10:8080 route=httpNode1
BalancerMember http://172.16.10.20:8080 route=httpNode2
ProxySet lbmethod=byrequests

 

Be careful with the nofailover option if you are using session-state replication.

Now, if you’re using a domain scenario don’t bet all your money on this technique… I haven’t gotten to domains yet, still using the old deployment scenarios.

The jboss CLI management console is kick-ass too, making our development deployments fast as lightning, maybe I’ll write about it sometimes.

Leave a Reply

Your email address will not be published. Required fields are marked *