Consider this scenario: The Varnish cache has MISS, and the backend server now regenerates the requested content. During generation, a second request arrives and also receives MISS. Does Luck send this request to the backend while another request is pending? What if a thousand requests arise between this time. Will the server work correctly? Each request will make it slower.
Is it right or polish to “sync” these scripts to prevent such a problem?
Thank you in advance!
The varnish sends all requests to the server. That is, he does not queue other requests and issues only one request for the backend and uses his answer for everyone.
Varnish , .
, VCL:
sub vcl_recv { if (req.backend.healthy) { set req.grace = 5m; } else { set req.grace = 24h; } } sub vcl_fetch { set beresp.grace = 24h; }
, (. -), MISS, . , < TTL + req.grace( 5 ), "" . , , MISS, ( ), , TTL + req.grace.
MISS
(req.backend.healthy == FALSE), , < TTL + 24h.
Varnish book .
: unescaped < .
: < ...
, () .
URI .
, . , ( ) . , .
, API, , ( Varnish), URI.
.., @max_i, , .
, Ketola, , , , , , , . , :
. .
, Varnish 4.1 LTS Apache 2.4, PHP , :
<?php sleep(5); echo 'hello world!';
ab, HTTP, 50 5 concurrency. , , , - , , , 5 . .
, , , " " , , , 50 , ( , concurrency 5).