Last active
December 26, 2021 08:56
-
-
Save GaetanoPiazzolla/b4ee296ff5f7764de8451cfdb3e61d3c to your computer and use it in GitHub Desktop.
Nginx configuration for huge load of concurrent requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code snippet Related to medium article:
https://blog.devgenius.io/an-epic-tale-comparing-jdbc-and-r2dbc-in-a-real-world-scenario-part-2-2-d908df49651c#823f-8a39553a5cf4