Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Advertise on LowEndTalk.com

apache+varnish slower than apache alone?
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

apache+varnish slower than apache alone?

I want to speed up web-server (I have to use apache) running on my VPS, so I installed varnish. I did not play much with configuration, just moved apache to 8080-port (using mpm_prefork, in default 5/5/10/150/0 configuration) and varnish to 80-port.

I used "curl" to check if requests are routed properly (index.html is the default "welcome" one on debian, ~10kB static file):
curl -I http://127.0.0.1/index.html (there is X-Varnish header, so its goes over varnish)
curl -I http://127.0.0.1:8080/index.html (this goes directly to apache)

Now I'm doing some benchmarks, but to my surprise I get slightly better results for pure apache, than for apache+varnish:
ab -c 50 -n 100000 http://127.0.0.1/index.html (~2300 req/sec)
ab -c 50 -n 100000 http://127.0.0.1:8080/index.html (~2500 req/sec)

How is this possible? I expected varnish would speed web up by at least factor 2, especially for static cacheable files...

Comments

  • understanding what varnish is used for is important first before installing.

  • Jarry said: How is this possible? I expected varnish would speed web up by at least factor 2, especially for static cacheable files...

    Unless you are bound by RAM. Doesn't varnish do in-ram caching?

  • Varnish does do in-ram caching, but in this case apache is taking advantage of system disk-cache (also in-ram). I have plenty of free ram right now, so it is clear to me I can not see any advantage here for static files.

    What surprises me is how good apache handles many concurrent requests. I tried increasing concurrency to "-c 5000", still the same. I remember doing this test some 5 years ago, with apache being able to do barely 20% req/sec, compared to varnish+apache...

    I'll do later some tests with my dynamic drupal-website, but for that some VCL-tweaks must be done first...

Sign In or Register to comment.