Welcome! Log In Create A New Profile

Advanced

Question about allowing a percentage of traffic

March 21, 2012 02:44PM
This is about traffic control, in the case we get slammed by heavier traffic than expected we want to be able to gracefully only allow part of the users' requests to come through.

In my current nginx config, I have a white list based on a $http_x_user_id header in the request and only allow traffic from those users.

The way I did it was a condition in the location / block:

if ( $http_x_user_id !~ (THE_WHITE_LIST_OF_IDs) ) {
return 503;
}

(We can control the white list dynamically and re-render the config with Chef.)

What I also need to do is to allow a certain percentage of requests from users whose id is not in the white list. For example, I need to be able to allow 30% of users in addition to those in the white list to get access. Based on my limited knowledge on nginx, I have no idea on what's the best way to do it.

Any insights?

Thanks a lot.
Subject Author Posted

Question about allowing a percentage of traffic

spacerobot March 21, 2012 02:44PM

Re: Question about allowing a percentage of traffic

Valentin V. Bartenev March 21, 2012 03:12PM

Re: Question about allowing a percentage of traffic

spacerobot March 23, 2012 03:41PM

Re: Question about allowing a percentage of traffic

Alexandr Gomoliako March 21, 2012 03:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 92
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready