1

I am using Jmeter to investigate the performance and capacity needs of a few web services. Jmeter sends traffic to the web-facing url (served by Nginx), with a rising rate, to see where the service fails. At the moment, this traffic is generated using a single machine, in the CI/CD pipeline.

Before I can really stress the resources, the web server is responding with HTTP 429

Is there a way to set data in the header or something to force each connection to be seen as new, instead of being banned by the server?

Edit : specified that the http server is nginx

0
2

Given that this is symptomatic of rate limiting in Nginx in this case, the solution is to configure the rate limiting feature of Nginx to allow this

A whitelist could be created in the configuration to remove ratelimiting from the url generating the traffic.

To follow the Nginx documentation, this could be specified as whitelisting an IP.

The current server setup is :

limit_req_zone $binary_remote_addr zone=flood:10m rate=12r/s;
limit_req_zone $binary_remote_addr zone=bot:10m rate=200r/m;
limit_req_status 429;
limit_conn_zone $binary_remote_addr zone=connperip:10m;
limit_conn_status 429;

This sets up the rate limit on connections. A whitelist can be created as suggested above, by simulating a boolean condition with a key value map:

geo $limit {
    default 1;
    10.0.0.0/8 0;
    192.168.0.0/24 0;
}

map $limit $limit_key {
    0 "";
    1 $binary_remote_addr;
}

This removes the rate limit (sets it to 0) if the remote address falls into the whitelist:

limit_req_zone $limit_key zone=req_zone:10m rate=5r/s;

server {
    location / {
        limit_req zone=req_zone burst=10 nodelay;
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.