0

My website has below request flow-

AWS CloudFront -> ELB -> Varnish 4.0.3 -> NginX (reverse proxy) -> ELB -> Drupal7

Working: Normal flow is working as expected.

Problem: When I run load-testing on my site, same request is coming to Drupal server multiple times. e.g. My jMeter bombarded 500 calls to http://website/index.php, ~50% requests hit Drupal server.

Expectation: Varnish should hold all the same request, until first responds.

Observation: Varnish sending all the same requests to back-end, until response for first request comes

If anyone have implemented such functionality please share

1 Answers1

1

It's weird because Varnish should hold these request as per the doc says : https://www.varnish-cache.org/docs/4.0/users-guide/vcl-grace.html

Maybe the first request that comes to the backend ends up in a non cacheable response that get "HIT-FOR-PASS" (subsequent same requests won't hit the cache but rather directly be fetched from the backend).

What is the output from varnishlog, are you sending special header that prevent caching?

Benjamin Baumann
  • 4,035
  • 2
  • 25
  • 35
  • Thanks for quick reply! My _hit is below- – Pankaj Shukla Oct 21 '16 at 14:52
  • sub vcl_hit { if (obj.ttl >= 0s) { # A pure unadultered hit, deliver it return (deliver); } if (std.healthy(req.backend_hint)) { if (obj.ttl + 10s > 0s) { return (deliver); } else { return(fetch); } } else { if (obj.ttl + obj.grace > 0s) { return (deliver); } else { return (fetch); } } return (fetch); } ------- 1. Is it correct 2. How to check requests, which are on hold, while Varnish fetching response from backend – Pankaj Shukla Oct 21 '16 at 14:56
  • This is your vcl (varnish config), I would like to see the varnish logs. This is the first thing to look at when troubleshooting varnish. You can see them in real time with `varnishlog` or the history with `varnishlog -d` . See https://www.varnish-cache.org/docs/4.0/users-guide/operation-logging.html – Benjamin Baumann Nov 01 '16 at 23:24