I adjusted Nginx for good performance

Tram Ho

Introduce

Hello, in this article I will share about how I am using to help Nginx achieve good performance. Normally, if nginx is configured correctly, it can handle up to 400k to 500k requests per second (clustered), most of them I see is 50k – 80k (non-clustered) requests per second and CPU reaches 30% with type 2 x Intel Xeon with HyperThreading enabled, but it can work without problems on slower machines.

This configuration is used in the test environment, not production, so if you want to apply it, you should find a way to implement the right ones for your server.

Perform

Install Nginx

First, we need to install nginx (skip if you’ve already installed it), here I use ubuntu:

Backup your original configs and you can start reconfigure your configs. You will need to open your nginx.conf at /etc/nginx/nginx.conf with your favorite editor.

config nginx

Next we need to backup the config and then you can reconfigure with the new config. You need to open /etc/nginx/nginx.conf :

After editing is complete, you need to reload nginx:

If you want to test config then run the following command:

Anti DDoS

This is a far cry from secure DDoS but can slow down some small DDoS. These configurations are also in a test environment, and you should customize them accordingly.

Retest the config:

If everything is ok then reload or restart nginx:

You can test the configuration with tsung and when you feel ok with the results, you can press Ctr + C (cancel) because it can run for hours.

summary

Above is how I used to install nginx with quite good performance ? ) hope to help, thanks for reading here ❤️

Happy coding !!! ❤️❤️❤️

Share the news now

Source : Viblo