Skip to content

Instantly share code, notes, and snippets.

@mikhailov
Last active April 19, 2021 08:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikhailov/ed06de16ba2757d66f2f59c867d51fdd to your computer and use it in GitHub Desktop.
Save mikhailov/ed06de16ba2757d66f2f59c867d51fdd to your computer and use it in GitHub Desktop.
Troubleshooting Application Performance and Slow TCP Connections with NGINX Amplify
upstream upstream_close_server_keepalive_timeout_0 {
server upstream:10443;
}
upstream upstream_keepalive_server_keepalive_timeout_0 {
server upstream:11443;
keepalive 64;
}
upstream upstream_close_server_keepalive_timeout_300 {
server upstream:12443;
}
upstream upstream_keepalive_server_keepalive_timeout_300 {
server upstream:13443;
keepalive 64;
}
upstream upstream_heavy_loaded {
server upstream:443;
}
upstream upstream_keepalive_heavy_loaded {
server upstream:443;
keepalive 64;
}
server {
listen 80;
### Part 1. Benchmark A
# siege -b -t 10m http://127.1/upstream-close/proxy_pass_connection-close/server_keepalive_timeout-0
###
location =/upstream-close/proxy_pass_connection-close/server_keepalive_timeout-0 {
proxy_pass https://upstream_close_server_keepalive_timeout_0/;
}
### Part 1. Benchmark B
# siege -b -t 10m http://127.1/upstream-close/proxy_pass_connection-keepalive/server_keepalive_timeout-0
###
location =/upstream-close/proxy_pass_connection-keepalive/server_keepalive_timeout-0 {
proxy_pass https://upstream_close_server_keepalive_timeout_0/;
proxy_set_header Connection "";
proxy_http_version 1.1;
}
### Part 1. Benchmark C
# siege -b -t 10m http://127.1/upstream-close/proxy_pass_connection-keepalive/server_keepalive_timeout-300
###
location =/upstream-close/proxy_pass_connection-keepalive/server_keepalive_timeout-300 {
proxy_pass https://upstream_close_server_keepalive_timeout_300/;
proxy_set_header Connection "";
proxy_http_version 1.1;
}
### Part 1. Benchmark D
# siege -b -t 10m http://127.1/upstream-keepalive/proxy_pass_connection-keepalive/server_keepalive_timeout-0
###
location =/upstream-keepalive/proxy_pass_connection-keepalive/server_keepalive_timeout-0 {
proxy_pass https://upstream_keepalive_server_keepalive_timeout_0/;
proxy_set_header Connection "";
proxy_http_version 1.1;
}
### Part 1. Benchmark E
# siege -b -t 10m http://127.1/upstream-keepalive/proxy_pass_connection-keepalive/server_keepalive_timeout-300
###
location =/upstream-keepalive/proxy_pass_connection-keepalive/server_keepalive_timeout-300 {
proxy_pass https://upstream_keepalive_server_keepalive_timeout_300/;
proxy_set_header Connection "";
proxy_http_version 1.1;
}
### Part 2. Benchmark A
# siege -b -t 20m http://127.1/upstream-heavy-loaded-close
###
location =/upstream-heavy-loaded-close/ {
proxy_pass https://upstream_heavy_loaded/;
}
### Part 2. Benchmark B
# siege -b -t 20m http://127.1/upstream-heavy-loaded-keepalive/
###
location =/upstream-heavy-loaded-keepalive/ {
proxy_pass https://upstream_keepalive_heavy_loaded/;
proxy_set_header Connection "";
proxy_http_version 1.1;
}
server {
listen 10443 ssl;
server_name _;
location =/ {
keepalive_timeout 0;
empty_gif;
}
}
server {
listen 11443 ssl;
server_name _;
location =/ {
keepalive_timeout 0;
empty_gif;
}
}
server {
listen 12443 ssl;
server_name _;
location =/ {
keepalive_timeout 300;
keepalive_requests 100000;
empty_gif;
}
}
server {
listen 13443 ssl;
server_name _;
location =/ {
keepalive_timeout 300;
keepalive_requests 100000;
empty_gif;
}
}
@mikhailov
Copy link
Author

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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