Hi,

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.

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.

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.

I've included details below of the test results and configuration below.

Thanks,
Robert Egglestone | Application Engineering Team Lead | The University of 
Auckland
[email protected]<mailto:[email protected]> | ext: 84624 | 
m: +64 21 240 8992 | Level 2, 58 Symonds St, Auckland, NZ

The test results are:

$ ab -n 10000 -c 110 localhost:6081/

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   2.0      1      10
Processing:     2    7   1.9      7      24
Waiting:        0    6   2.1      6      24
Total:          5    8   1.9      8      24

$ ab -n 10000 -c 129 localhost:6081/

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    4   3.1      5      10
Processing:     2    8   2.0      8      25
Waiting:        0    7   2.5      6      24
Total:          6   12   2.5     13      25

$ ab -n 10000 -c 130 localhost:6081/

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   2.6      1      10
Processing:     2    8   3.6      7     215
Waiting:        0    7   3.7      7     214
Total:          6   10   3.8     10     215

$ ab -n 10000 -c 150 localhost:6081/

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   2.7      2      12
Processing:     2    8  12.2      7     523
Waiting:        0    7  12.3      6     523
Total:          6   11  12.3     10     523


The Varnish startup parameters I'm using are:

/usr/sbin/varnishd -F -a :6081
-f /etc/varnish/webroute.vcl
-T 127.0.0.1:6082
-t 120
-w 2000,2000,120
-u varnish -g varnish
-S /etc/varnish/secret
-s file,/var/lib/varnish/varnish_storage.bin,1G

The Varnish configuration is:

backend apache {
  .host = "127.0.0.1";
  .port = "8080";
}

#
# Serve stale content while retrieving content from backend
# https://www.varnish-cache.org/trac/wiki/VCLExampleGrace
#

sub vcl_recv {
  set req.grace = 30s;
}

sub vcl_fetch {
  set beresp.grace = 30s;
}

#
# Normalize cookies
#

sub vcl_recv {
  # Remove has_js and Google Analytics __* cookies.
  set req.http.Cookie = regsuball(req.http.Cookie, 
"(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");
  # Remove a ";" prefix, if present.
  set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");

  # Cookies
  if (req.http.Cookie == "") {
    remove req.http.Cookie;
  }
}

#
# Normalize Accept-Encoding header
#

sub vcl_recv {
  if (req.http.Accept-Encoding) {
    if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
      # No point in compressing these
      remove req.http.Accept-Encoding;
    } elsif (req.http.Accept-Encoding ~ "gzip") {
      set req.http.Accept-Encoding = "gzip";
    } elsif (req.http.Accept-Encoding ~ "deflate") {
      set req.http.Accept-Encoding = "deflate";
    } else {
      # unknown algorithm
      remove req.http.Accept-Encoding;
    }
  }
}

#
# Allow items to be purged from the cache
#

acl purgers {
  "127.0.0.1";
}

sub vcl_recv {
  if (req.request == "PURGE") {
    if (!client.ip ~ purgers) {
      error 405 "Method not allowed";
    }
    return (lookup);
  }
}

sub vcl_hit {
  if (req.request == "PURGE") {
    purge;
    error 200 "Purged";
  }
}

sub vcl_miss {
  if (req.request == "PURGE") {
    purge;
    error 404 "Not in cache";
  }
}

sub vcl_pass {
  if (req.request == "PURGE") {
    error 502 "PURGE on a passed object";
  }
}

#
# ESI support
# http://www.w3.org/TR/edge-arch
#
# http://symfony.com/doc/2.0/cookbook/cache/varnish.html
#

sub vcl_recv {
  set req.http.Surrogate-Capability = "webroute=ESI/1.0";
}

sub vcl_fetch {
  if (beresp.http.Surrogate-Control ~ "ESI/1.0") {
    unset beresp.http.Surrogate-Control;
    set beresp.http.X-ESI = "true";
    set beresp.do_esi = true;
  }
}

#
# Debugging
#

sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Cache = "HIT";
    set resp.http.X-Cache-Hits = obj.hits;
  } else {
    set resp.http.X-Cache = "MISS";
  }
}


_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to