host is lagging

Lasse Karstensen lkarsten at varnish-software.com
Tue Jun 3 14:45:20 CEST 2014


On Fri, May 30, 2014 at 03:53:04PM -0400, Tim Dunphy wrote:
>  A couple of the web servers out of a farm of 6 machines we're load
> balancing with varnish is showing high cpu use. We're balancing them using
> the round robin LB scheme. I was just wondering if there are any varnish
> based tools (varnishstat, varnishlog, varnishtop or something else) that
> might be able to tell me which hosts are underperforming.

Given that you are on 4.0, you can use a vsl-query to varnishlog to pick
out backend requests that are taking a long time to complete.

    # varnishlog -q 'Timestamp:Beresp[2] > 0.3'

(or if you're looking for client-side response times)

    # varnishlog -q 'Timestamp:Resp[2] > 0.3'

Unit is in seconds, so "slow" means 300ms in this example.
The Backend log lines will tell you which backend was used.

If you are on 3.0, you'll have to parse the response time from ReqEnd
yourself. Format is documented in the wiki.


> Also I was wondering if maybe there might be a better scheme to try (like
> least-conn?) that might be better for alleviating high CPU usage or high
> load?

You can adjust the weights if they're not equally powerful, that is
about it I think.

There have been talk about a least-connections backend director for 4.0,
but I don't think anyone has completed/published one yet.

The best solution is of course to lower the load on your backend servers.
Fix the application, disable backend-side gzip, make sure connections
are reused, limit concurrent backend connections or increase TTL if
possible.

Unless you have a very odd webapp, you are IO-bound and not CPU-bound.
Buying more memory chips is usually a cheap and simple short term fix
for this. :-)

-- 
Lasse Karstensen



More information about the varnish-misc mailing list