<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>Hi,</div>
<div><br>
</div>
<div>I have Varnish 3.0.3 on RHEL6 configured to use 2000 worker threads (both min and max). While testing, at the point of exactly 130 concurrent requests, I consistently see the maximum response time jump up, and continue to grow as the number of concurrent
requests increases. I'm wondering if it's hitting a limit at this point causing the requests to be queued.</div>
<div><br>
</div>
<div>I need to be able to process up to 500 concurrent requests with fairly consistent performance to take this through to production. The material I've seen online suggests that this should be no problem, so I'm wondering if I've overlooked a configuration
setting.</div>
<div><br>
</div>
<div>The backend is an Apache server returning a redirect. I've tested directly against the backend too and that shows the maximum response times increasing fairly linear with the number of concurrent requests - the maximum response time does not jump up like
this.</div>
<div><br>
</div>
<div>I've included details below of the test results and configuration below.</div>
<div><br>
</div>
<div>Thanks,</div>
<div><span class="x_Apple-style-span" style="border-collapse: separate; ">
<div style="word-wrap: break-word; ">Robert Egglestone <span class="x_Apple-style-span" style="color: rgb(121, 121, 121); font-size: small; ">| Application Engineering Team Lead | The University of Auckland</span></div>
</span><font class="x_Apple-style-span" color="#797979" size="2"><span class="x_Apple-style-span" style="border-collapse: separate; ">
<div style="word-wrap: break-word; "><span class="x_Apple-style-span" style="border-collapse: separate; ">
<div style="word-wrap: break-word; "><span class="x_Apple-style-span" style="border-collapse: separate; ">
<div style="word-wrap: break-word; "><span class="x_Apple-style-span" style="border-collapse: separate; ">
<div style="word-wrap: break-word; "><a href="mailto:r.egglestone@auckland.ac.nz">r.egglestone@auckland.ac.nz</a> | ext: 84624 | m: +64 21 240 8992 | Level 2, 58 Symonds St, Auckland, NZ</div>
</span></div>
</span></div>
</span></div>
</span></font></div>
<div><br>
</div>
<div>The test results are:</div>
<div><br>
</div>
<div>
<div><font face="Courier New">$ ab -n 10000 -c 110 localhost:6081/</font></div>
<div><br>
</div>
<div><font face="Courier New">Connection Times (ms)</font></div>
<div><font face="Courier New"> min mean[+/-sd] median max</font></div>
<div><font face="Courier New">Connect: 0 2 2.0 1 10</font></div>
<div><font face="Courier New">Processing: 2 7 1.9 7 24</font></div>
<div><font face="Courier New">Waiting: 0 6 2.1 6 24</font></div>
<div><font face="Courier New">Total: 5 8 1.9 8 24</font></div>
<div><font face="Courier New"><br>
</font></div>
<div><font face="Courier New">$ ab -n 10000 -c <b><font color="#ff2600">129</font></b> localhost:6081/</font></div>
<div><font face="Courier New"><br>
</font></div>
<div><font face="Courier New">Connection Times (ms)</font></div>
<div><font face="Courier New"> min mean[+/-sd] median max</font></div>
<div><font face="Courier New">Connect: 0 4 3.1 5 10</font></div>
<div><font face="Courier New">Processing: 2 8 2.0 8 <b><font color="#ff2600">25</font></b></font></div>
<div><font face="Courier New">Waiting: 0 7 2.5 6 <b><font color="#ff2600">24</font></b></font></div>
<div><font face="Courier New">Total: 6 12 2.5 13 <b><font color="#ff2600">25</font></b></font></div>
<div><font face="Courier New"><br>
</font></div>
<div><font face="Courier New">$ ab -n 10000 -c <b><font color="#ff2600">130</font></b> localhost:6081/</font></div>
<div><font face="Courier New"><br>
</font></div>
<div><font face="Courier New">Connection Times (ms)</font></div>
<div><font face="Courier New"> min mean[+/-sd] median max</font></div>
<div><font face="Courier New">Connect: 0 2 2.6 1 10</font></div>
<div><font face="Courier New">Processing: 2 8 3.6 7 <b><font color="#ff2600">215</font></b></font></div>
<div><font face="Courier New">Waiting: 0 7 3.7 7 <b><font color="#ff2600">214</font></b></font></div>
<div><font face="Courier New">Total: 6 10 3.8 10 <b><font color="#ff2600">215</font></b></font></div>
<div><font face="Courier New"><br>
</font></div>
<div><font face="Courier New">$ ab -n 10000 -c 150 localhost:6081/</font></div>
<div><font face="Courier New"><br>
</font></div>
<div><font face="Courier New">Connection Times (ms)</font></div>
<div><font face="Courier New"> min mean[+/-sd] median max</font></div>
<div><font face="Courier New">Connect: 0 3 2.7 2 12</font></div>
<div><font face="Courier New">Processing: 2 8 12.2 7 523</font></div>
<div><font face="Courier New">Waiting: 0 7 12.3 6 523</font></div>
<div><font face="Courier New">Total: 6 11 12.3 10 523</font></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>The Varnish startup parameters I'm using are:</div>
<div><br>
</div>
<div>/usr/sbin/varnishd -F -a :6081</div>
<div>-f /etc/varnish/webroute.vcl</div>
<div>-T 127.0.0.1:6082</div>
<div>-t 120</div>
<div>-w 2000,2000,120</div>
<div>-u varnish -g varnish</div>
<div>-S /etc/varnish/secret</div>
<div>-s file,/var/lib/varnish/varnish_storage.bin,1G</div>
<div><br>
</div>
<div>The Varnish configuration is:</div>
<div><br>
</div>
<div>
<div>backend apache {</div>
<div> .host = "127.0.0.1";</div>
<div> .port = "8080";</div>
<div>}</div>
<div><br>
</div>
<div>#</div>
<div># Serve stale content while retrieving content from backend</div>
<div># <a href="https://www.varnish-cache.org/trac/wiki/VCLExampleGrace">https://www.varnish-cache.org/trac/wiki/VCLExampleGrace</a></div>
<div>#</div>
<div><br>
</div>
<div>sub vcl_recv {</div>
<div> set req.grace = 30s;</div>
<div>}</div>
<div><br>
</div>
<div>sub vcl_fetch {</div>
<div> set beresp.grace = 30s;</div>
<div>}</div>
<div><br>
</div>
<div>#</div>
<div># Normalize cookies</div>
<div>#</div>
<div><br>
</div>
<div>sub vcl_recv {</div>
<div> # Remove has_js and Google Analytics __* cookies.</div>
<div> set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");</div>
<div> # Remove a ";" prefix, if present.</div>
<div> set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");</div>
<div><br>
</div>
<div> # Cookies</div>
<div> if (req.http.Cookie == "") {</div>
<div> remove req.http.Cookie;</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>#</div>
<div># Normalize Accept-Encoding header</div>
<div>#</div>
<div><br>
</div>
<div>sub vcl_recv {</div>
<div> if (req.http.Accept-Encoding) {</div>
<div> if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {</div>
<div> # No point in compressing these</div>
<div> remove req.http.Accept-Encoding;</div>
<div> } elsif (req.http.Accept-Encoding ~ "gzip") {</div>
<div> set req.http.Accept-Encoding = "gzip";</div>
<div> } elsif (req.http.Accept-Encoding ~ "deflate") {</div>
<div> set req.http.Accept-Encoding = "deflate";</div>
<div> } else {</div>
<div> # unknown algorithm</div>
<div> remove req.http.Accept-Encoding;</div>
<div> }</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>#</div>
<div># Allow items to be purged from the cache</div>
<div>#</div>
<div><br>
</div>
<div>acl purgers {</div>
<div> "127.0.0.1";</div>
<div>}</div>
<div><br>
</div>
<div>sub vcl_recv {</div>
<div> if (req.request == "PURGE") {</div>
<div> if (!client.ip ~ purgers) {</div>
<div> error 405 "Method not allowed";</div>
<div> }</div>
<div> return (lookup);</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>sub vcl_hit {</div>
<div> if (req.request == "PURGE") {</div>
<div> purge;</div>
<div> error 200 "Purged";</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>sub vcl_miss {</div>
<div> if (req.request == "PURGE") { </div>
<div> purge;</div>
<div> error 404 "Not in cache";</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>sub vcl_pass {</div>
<div> if (req.request == "PURGE") {</div>
<div> error 502 "PURGE on a passed object";</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>#</div>
<div># ESI support</div>
<div># <a href="http://www.w3.org/TR/edge-arch">http://www.w3.org/TR/edge-arch</a></div>
<div># </div>
<div># <a href="http://symfony.com/doc/2.0/cookbook/cache/varnish.html">http://symfony.com/doc/2.0/cookbook/cache/varnish.html</a></div>
<div>#</div>
<div><br>
</div>
<div>sub vcl_recv {</div>
<div> set req.http.Surrogate-Capability = "webroute=ESI/1.0";</div>
<div>}</div>
<div><br>
</div>
<div>sub vcl_fetch {</div>
<div> if (beresp.http.Surrogate-Control ~ "ESI/1.0") {</div>
<div> unset beresp.http.Surrogate-Control;</div>
<div> set beresp.http.X-ESI = "true";</div>
<div> set beresp.do_esi = true;</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>#</div>
<div># Debugging</div>
<div>#</div>
<div><br>
</div>
<div>sub vcl_deliver {</div>
<div> if (obj.hits > 0) {</div>
<div> set resp.http.X-Cache = "HIT";</div>
<div> set resp.http.X-Cache-Hits = obj.hits;</div>
<div> } else {</div>
<div> set resp.http.X-Cache = "MISS";</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
</div>
<br>
</body>
</html>