Does anyone have some performance metrics for Varnish in front of 1) Tomcat or 2) Apache with mod_jk (connected to Tomcat). I know that the AJP connector is supposedly faster than HTTP, but I was thinking that Varnish which is lighter and highly optimized could perform better talking direcly to Tomcat. There is also the discussion around static resources (which I think will perform faster with Varnish than Apache, even with mod_cache) and dynamic pages.

  • Unfortunately no one has done a benchmark in this area. What I decided was to use Varnish in front of Tomcat7 and Nginx as a SSL wrapper.
    – Adrian Ber
    Nov 25 '13 at 11:34

Generally Varnish can deliver a cache hit several orders of magnitude faster than Tomcat - typically TTFB is microseconds for Varnish and milliseconds for Tomcat. So, the performance of the connector (AJP vs HTTP) probably won't matter when Varnish is involved. So, go for the simpler setup - have Tomcat speak directly to Varnish. The marginal effect AJP might have will be completely insignificant.

If you are considering not having Varnish there at all I think the question you should be asking yourself is what the hit rate for the dynamic pages from Tomcat will be. If it is >20% then I think the overall performance increase might be worth the extra complexity, depending on how heavy the pages are.

  • So, what you're saying is that Varnish+HTTP will perform better than Apache+AJP? So, if dynamic pages hits are more than 20% than Apache is the way?
    – Adrian Ber
    Oct 16 '13 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.