Limit requests to backend based on requested domain?

Dridi Boukelmoune dridi at varni.sh
Wed Aug 30 18:55:34 CEST 2017


On Wed, Aug 30, 2017 at 6:28 PM,  <jpotter-varnish at codepuppy.com> wrote:
>
> Thanks, Guillaume and Dridi — I’m not seeing a way to limit concurrent
> requests however. We’re using vsthrottle to limit the total number of
> requests to a domain — i.e. “100 requests in 10 seconds; 600 requests in 5
> minutes”; but that doesn’t guard against the case of someone’s PHP script
> blocking (say, external API request from some wordpress plugin), and when
> that happens, those PHP workers pile up pretty fast. Normally, requests to
> the backend at the rate of something like 100 per second in total would be
> reasonable, but in the case of bad backend PHP code in one domain, well;
> it’d resource starve workers for all the domains on that backend server
> (shared hosting).

Correct.

> Perhaps this is something that’s similar enough to what vsthrottle does that
> I should fork it and figure out how to implement it as a counter instead?

Browse the issue tracker, we may have discussed that at some point but
I'm not sure. Please also have a look at the old repositories before
it got bundled to varnish-modules. We are close to the next Varnish
release and I can't spend much time on this.

https://github.com/varnish/libvmod-vsthrottle

The problem with explicit inc/dec operations is that they may not be
balanced, so you'll need a PRIV_TASK to keep track of that and clear
the state if the transaction ends with a positive balance.

Dridi



More information about the varnish-misc mailing list