I would like to protect a backend server by having Squid send a single request to a the server when there is a cache miss for a resource. During the fetching, other requests should be put on hold until the single requests returns.
The header stale-while-revalidate
almost does what I want, however when both the times of max-age
and stale-while-revalidate
have passed there is no stale response and multiple requests will be send to the backend.
The directive collapsed_forwarding
seems to be exactly what i'm looking for. But i'm unable to get this to work as expected, still seeing multiple request to the backend within the max-age period. I'm testing this with SoapUI 5.2.1 Simple Load Test with 40 threads.
My current configuration for Squid (3.5.19) is the default configuration with the following changes:
#Queue incomming requests when a request is send to the backend. I.E. collapse request into a single backend request.
collapsed_forwarding on
# Squid normally listens to port 3128
http_port 3128 accel no-vhost defaultsite=localhost ignore-cc
#Backend requires basic auth
cache_peer 127.0.0.1 parent 53142 0 no-query originserver name=myAccel login=username:password
#Allow caching of files that have a ttl of 1 seconds
minimum_expiry_time 1 seconds
acl our_sites dstdomain localhost
http_access allow our_sites
cache_peer_access myAccel allow our_sites
cache_peer_access myAccel deny all
Request URI: /rest/information/bridge/Test?isrs=AB12345
Response header Cache-Control no-transform, max-age=2