Limit_conn and limit_conn_zone – Limit the number of client connections NGINX accepts, for example from a single IP address. Setting them can help prevent individual clients from opening too many connections and consuming more than their share of resources.
Be aware that this solution limits nginx download speed per connection, so, if one user opens multiple video files, it will be able to download 150k x the number of times he connected to the video files. If you need to set a limit to the connections, you should be able to do it with limit_zone and limit_conn directives.
We have a problem with Nginx. We have a converter server it's convert MP4 video to MP3 file and 300 user online, so when they start download their MP3 files at the same time, server time response become so huge like if it is freezed even if%vCPU doesn't exceeds 10% when he start the conversion using mpeg library.
I have an application that can accept file uploads and puts those onto S3. Some files have been failing to upload when going through the nginx reverse-proxy.
Now, I have keepalive_timeout 120; set in the nginx.conf as well as
set on my application's sites-available/ sites-enabled configurations.
Even after restarting nginx this issue reoccurs. Relevant error.log message:
The thing is, I don't think this is actually a timeout issue. Uploading a file takes around 8 seconds total to upload without going through the proxy. Using the proxy will have the file hang for a minute or two and then errors out.
90% of files uploaded into the application are PDF's, all of them underneath the body size limit.