Nginx Tuning - Timeouts Modules for better performance

Viewed 16

We are using Nginx as a proxy server. It has linked up 10+ upstream servers and I have different types of microservices where we use different technologies like java, nodejs, PHP, etc.

We are trying to do better server performance by tuning the Nginx configuration file. We have changed the timeouts values for testing to see how Nginx reacts to the changes, Here are the followings:

Previous Timeouts Configuration (Before Tuning Values):

proxy_connect_timeout 60m;
proxy_read_timeout 60m;
proxy_send_timeout 60m;
keepalive_timeout 3600;
client_body_timeout 3600;
send_timeout 3600;

We have changed this as like (Tuning Values):

proxy_connect_timeout 3s;
proxy_read_timeout 3s;
proxy_send_timeout 5s;
keepalive_timeout 15;
client_body_timeout 12;
send_timeout 10;

We have applied this change for our one microservice and we have noticed that our server gives better performance. We tested it by running JMeter and k6 load testing. We tested it before tuning and after tuning to compare the performance that increase or decrease.

Again we do this for our two more microservices and got a better result (I mean increased the performance). But we got bad results and lower performance for one microservice (I mean decreased performance).

Now the issue is, After changing when we again change back the timeout value on the previous one (I mean before tuning values), It didn't roll back the performance like to the previous performance. It is showing the performance the same as after the tuning performance.

We want to roll back in previous performance (before tuning) when we needed and again tune it for better performance when we again need it. But we couldn't do that. Once we tuned one microservice then we couldn't go back to the previous performance. If we even change the values again, it didn't affect it shows only the first tuning performance.

We rebuild our services, restart, reload the Nginx service, reboot the Nginx server which act as a proxy server, and also reboot upstream servers but in bad luck, we couldn't roll back. Rollback means we want those performances that were before tuning.

Any suggestions, ideas, or help will be helpful for us and will be appreciatable. Advanced thanks.

0 Answers
Related