Limit requests to backend based on requested domain?

jpotter-varnish at codepuppy.com jpotter-varnish at codepuppy.com
Wed Aug 30 18:28:34 CEST 2017


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).

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?

Thanks,
Jeff

> On Aug 30, 2017, at 4:22 AM, Guillaume Quintard <guillaume at varnish-software.com> wrote:
> 
> Hi Jeff,
> 
> have a look at vmod_vsthrottle in varnish-modules, that should do it.
> 
> -- 
> Guillaume Quintard
> 
> On Wed, Aug 30, 2017 at 9:24 AM, <jpotter-varnish at codepuppy.com <mailto:jpotter-varnish at codepuppy.com>> wrote:
> 
> Hi,
> 
> Is there a way to limit the number of concurrent requests sent to a backend based on the requested domain name? Or more broadly, based on some key/value?
> 
> I know I can limit the number of requests to a backend with max requests, but our backend services multiple domains, and I’m wanting to limit the number of requests per domain (so that too many requests to one doesn’t cut off resources for others). I’ve thought of maybe doing this by defining multiple backends (pointed at the same server), but then I worry that the health checks we run would stack up (i.e. if there are a 100 domains, going from 1 backend to 100 backends would presumable increase the health checks 100 times).
> 
> Thanks,
> Jeff
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org <mailto:varnish-misc at varnish-cache.org>
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc <https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20170830/037a1df6/attachment.html>


More information about the varnish-misc mailing list