Skip to content

Instantly share code, notes, and snippets.

@GaetanoPiazzolla
Last active December 26, 2021 08:56
Show Gist options
  • Save GaetanoPiazzolla/b4ee296ff5f7764de8451cfdb3e61d3c to your computer and use it in GitHub Desktop.
Save GaetanoPiazzolla/b4ee296ff5f7764de8451cfdb3e61d3c to your computer and use it in GitHub Desktop.
Nginx configuration for huge load of concurrent requests
user nginx;
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes auto;
# number of file descriptors used for nginx
worker_rlimit_nofile 100000;
events {
# determines how much clients will be served per worker
worker_connections 4000;
# optimized to serve many clients with each thread, essential for linux -- for testing environment
multi_accept on;
# accept as many connections as possible, may flood worker connections if set too low -- for testing environment
use epoll;
}
http {
server {
# to boost I/O on HDD we can disable logs
access_log off;
error_log off;
# copies data between one FD and other from within the kernel
sendfile on;
# send headers in one piece, it is better than sending them one by one
tcp_nopush on;
# don't buffer data sent, good for small data bursts in real time
tcp_nodelay on;
# number of requests client can make over keep-alive -- for testing environment
keepalive_requests 100000;
listen 4000;
location /spring-r2dbc/ {
proxy_pass http://spring-r2dbc:8080/;
}
location /spring-jdbc/ {
proxy_pass http://spring-jdbc:8080/;
}
}
}
@GaetanoPiazzolla
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment