0

I am just trying to get varnish in front of Glassfish instances, which are load balanced with the mod_jk connector in Apache. But I don't really know how to combine them. The AJP_Ports for instances are e.g. 8009, 8010, 8011. I am not able to access them via the browser, but I can access the normal HTTP ports like 28080. For the 28080 ports I can put varnish in front of them. For the AJP_ports it's not possible.

Do you know a way where I can load balancer glassfish instances which are cached using varnish? Is it impossible to do this with mod_jk?

KM.
  • 1,786
  • 2
  • 18
  • 31
disco crazy
  • 277
  • 6
  • 14
  • 1
    Can you put apache between varnish and your app server? So you have `incoming --> varnish --> apache --> app server`? – KM. Jan 31 '12 at 18:10
  • Hmm. I've thought that the problem is here, that varnish doesn't support https. But doesn't it make sense to put: incoming --> apache --> load balancer --> varnish --> appserver instance ? – disco crazy Jan 31 '12 at 21:15
  • 1
    Ah, but you didn't mention https (-: Typically, you'd want varnish in front of apache. Varnish caches are *fast* (memory or file) which makes it better at taking a large amounts of incoming traffic than apache or your app server. This eases the load on the components behind it, like apache, app servers, db, etc. What is the reasoning behind your setup (curious mostly)? – KM. Feb 01 '12 at 16:00
  • The idea is to get less load on the application server and cache some responses. – disco crazy Feb 01 '12 at 17:33
  • So you're using apache+mod_jk as a load balancer? Here apache will take the hit first, which under high load could be problematic. Varnish in front of apache should be able do the same thing and do it better; you can also use Varnsh as a load balancer ... but you know your setup best and you have to maintain it (-: Looks like you go it working. Good luck! – KM. Feb 01 '12 at 19:31
  • Yeah, I used to use mod_jk, but not switched to nginx. I don't know. This works good, but the maintenance with multiple Varnishes scares me, too. :) Thanks for your feedback. – disco crazy Feb 02 '12 at 09:20

1 Answers1

0

Ok, what I have done now is to load balance via nginx (see this example). Varnish is running on each instance server in front of the Glassfish instance. And nginx balances over this varnish servers. I don't know if this is the perfect setup but it seems to work.

disco crazy
  • 277
  • 6
  • 14