How to design pound -> varnish -> jboss for ha + loadbalancing

httpsjbossload balancingvarnish

I'm planning a new infrastructure for our web application. We have two JBossAS5 servers, running in a cluster. Session state will be replicated via JBoss Cache.

In front of that, there should be some cache, to speed up delivery of static elements. However, most of the traffic to our app will be via HTTPS.

So far, I had been thinking of two Varnish caches in front of the JBossASs, each being configured for loadbalancing to the two JBossASs via round-robin. Since Varnish doesn't handle HTTPS, then there would need to be two pound proxies in front of the Varnishs, dealing with the HTTPS. The two pounds would be made high-available with Heartbeat/LinuxHA.

The traffic to www.example.com would then be going through our firewall, from there to the virtual IP of the pounds, from there to the Varnishs, and from there to the JBossASs.

Question 1: Does this make sense? Or is it overly complicated, and the same goal can be reached with simpler methods?

Question 2: If my layout is fine, how do I configure the pound -> Varnish step? Should I a) make the Varnish service high-available through Heartbeat/LinuxHA as well and direct traffic from pound to the virtual IP of the Varnishs, or should I rather b) Configure two independent Varnishs and use load-balancing in pound to address the different Varnishs?

Getting hardware loadbalancing is not an option, unfortunately, because of costs. This is no corporate, but a NGO system, and we're always short on money … The whole thing is not mission-critical, but I'd like it to be as reliable as possible, because our IT is not always available on short notice (we don't have any full-time IT person employed …).

Thanks a lot for your insight!

Andreas.

Best Answer

I think your approach makes sense. If you do not have the need for advanced caching of dynamic objects, then I would suggest using nginx as its capable of caching, https and loadbalancing. I do love Varnish, and I think most sites can gain a lot by using it, but based on your information it would make more sense to use nginx (+ heartbeat, or carp).

  • Nginx can cache dynamic objects, but I don't think it's possible to write rules based on uris (or part of them), cookies, connecting ip etc etc. Nginx can cache to disk and memcached, so it would be possible for your pair of nginx to have the same cache, more or less.
  • Can balance load, I think based on a session, ip hash and a lot more.
  • Does https very well.

Good luck! :)