Pankaj Shukla
Pankaj Shukla

Reputation: 11

How to hold same requests going to backend in varnish4.0.3 until first one responds

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

Upvotes: 0

Views: 637

Answers (1)

Benjamin Baumann
Benjamin Baumann

Reputation: 4065

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?

Upvotes: 1

Related Questions