Skip to content

Instantly share code, notes, and snippets.

@cwhsu1984
Created December 30, 2017 13:39
Show Gist options
  • Save cwhsu1984/8da07027438ee78e16a2ced78449a6ad to your computer and use it in GitHub Desktop.
Save cwhsu1984/8da07027438ee78e16a2ced78449a6ad to your computer and use it in GitHub Desktop.
config nginx for concurrent connections
# ec2 t2.micro can get over 20k connections by adding this line to nginx.conf
# test on ubuntu 16.04
# modify /etc/nginx/nginx.conf
worker_connections 10240;
# restart nginx
sudo systemctl reload nginx
# tool for testing
https://github.com/giltene/wrk2
# cmd to test your nginx server
wrk -t2 -c100 -d30s -R2000 http://127.0.0.1:8080/index.html
# grep access log to see concurrent connections
awk '{ print $4 }' /var/log/nginx/access.log | awk -F: '{ print $2 ":" $3 ":" $4 }'|sort|uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment