GUI / http-stale-cache-proxy

A non-compliant HTTP caching proxy that excels at serving stale cached content, while keeping its cache updated asynchronously.
MIT License
15 stars 5 forks source link

Prevent Webserver Stampede #2

Open DonatelloXX opened 10 years ago

DonatelloXX commented 10 years ago

Feature request: Implement "something" against a webserver stampede.

If many Requests are made it seems everyone ist forwarded to the webserver. Especially with "expensive" requests it would be interesting to implement something like "collapsed forwarding". If an async request for www.example.com/longrunningscript.php is in progress, then other requests to this url should be suppressed until the webserver sends a response.

GUI commented 10 years ago

Sorry again for the delay in responding. Yes, I agree this behavior would definitely be ideal, however I'm not sure if I'll be able to get to this anytime soon (although I'm certainly happy to accept pull requests).

Now that Varnish 4 is out, I'll probably be circling back to that for cases where this kind of stale proxy was previously necessary. Varnish 4 now supports "Background (re)fetch of expired objects. On a cache miss where a stale copy is available, serve the client the stale copy while fetching an updated copy from the backend in the background."

I haven't gotten a chance to test Varnish 4 yet, but if it now behaves the way I think it does, I'm not sure how relevant this custom proxy project is any longer (at least for my own use, since I generally use Varnish anyway). Varnish will also properly deal with concurrent requests to prevent a stampede with its grace mode.

So is using Varnish 4 something you'd consider? I think it might handle all of this in a much more robust way. Or would you prefer to keep using this node based proxy for any reason?