From 45ace05cd35b13010bdb5854b99fc2c3562f230b Mon Sep 17 00:00:00 2001 From: chrisakker Date: Wed, 12 Mar 2025 13:16:30 -0700 Subject: [PATCH 1/3] lab5 remove wrk --- labs/lab5/final/upstreams.conf | 8 ++++---- labs/lab5/readme.md | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/labs/lab5/final/upstreams.conf b/labs/lab5/final/upstreams.conf index 80aadef..2e6492e 100644 --- a/labs/lab5/final/upstreams.conf +++ b/labs/lab5/final/upstreams.conf @@ -6,7 +6,7 @@ upstream nginx_cafe { # Upstream block, the name is "nginx_cafe" # Uncomment the zone directive below to add metrics to the Dashboard - # zone nginx_cafe 256k; + zone nginx_cafe 256k; # Load Balancing Algorithms supported by NGINX # - Round Robin (Default if nothing specified) @@ -15,7 +15,7 @@ upstream nginx_cafe { # Upstream block, the name is "nginx_cafe" # - Hash (Any generic Hash) # Uncomment for Least Time Last Byte algorithm - # least_time last_byte; + least_time last_byte; # From Docker-Compose: server web1:80; @@ -23,10 +23,10 @@ upstream nginx_cafe { # Upstream block, the name is "nginx_cafe" server web3:80; # Uncomment for Cookie persistence - # sticky cookie srv_id expires=1m domain=.example.com path=/; + sticky cookie srv_id expires=1m domain=.example.com path=/; # Uncomment for keepalive TCP connections to upstreams - # keepalive 16; + keepalive 16; } diff --git a/labs/lab5/readme.md b/labs/lab5/readme.md index ac6ac69..b8fef3d 100644 --- a/labs/lab5/readme.md +++ b/labs/lab5/readme.md @@ -874,7 +874,7 @@ Different backend applications may benefit from using different load balancing t `wrk` load generation tool is a docker container that will download and run, with 4 threads, at 200 connections, for 1 minute: ```bash - docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://$NAME-nginx-plus/coffee + docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://nginx-plus/coffee ``` @@ -950,7 +950,7 @@ Different backend applications may benefit from using different load balancing t ![Cafe with Keepalive](media/lab5_cafe-perf-keepalive.png) - >But this points out a very important concept to be aware of: NGINX uses HTTP/1.0 to all upstreams by default. HTTP/1.0 is limited to a single TCP connection for a single HTTP object on the web page. If you have hundreds of web objects, you will need hundreds of TCP connections. This is a large waste of time and resources, so adding TCP Keepalives and HTTP/1.1 will make a significant improvement in performance in most cases. + >**But this points out a very important concept to be aware of: NGINX uses HTTP/1.0 to all upstreams by default.** HTTP/1.0 is limited to a single TCP connection for a single HTTP object on the web page. If you have hundreds of web objects, you will need hundreds of TCP connections. This is a large waste of time and resources, so adding TCP Keepalives and HTTP/1.1 will make a significant improvement in performance in most cases.
@@ -989,7 +989,7 @@ Different backend applications may benefit from using different load balancing t 1. For a fun test, hit it again with `wrk`...what do you observe? Do admin weights help or hurt performance? ```bash - docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://$NAME-nginx-plus/coffee + docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://nginx-plus/coffee ``` @@ -1053,7 +1053,7 @@ Different backend applications may benefit from using different load balancing t 1. You should now have `4 workers`, `least_time last_byte` and `keepalive` **enabled**. Run the `wrk` load generation tool again. **CRANK IT UP!** ```bash - docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://$NAME-nginx-plus/coffee + docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://nginx-plus/coffee ``` Within the `$NAME-nginx-plus` container, run `top` to see the NGINX Workers at work. Should look something like this: @@ -1083,7 +1083,7 @@ Different backend applications may benefit from using different load balancing t 1. Run the `wrk` load generator again for 1 minute. ```bash - docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://$NAME-nginx-plus/coffee + docker run --name wrk --network=lab5_default --rm elswork/wrk -t4 -c200 -d1m -H 'Host: cafe.example.com' --timeout 2s http://nginx-plus/coffee ``` After the 1 minute run of `wrk` load generation tool has finished, you should see a Summary of the statistics. It should look similar to this: From 9b9373d563e2d958a206271274a58777751b9140 Mon Sep 17 00:00:00 2001 From: chrisakker Date: Wed, 12 Mar 2025 13:21:10 -0700 Subject: [PATCH 2/3] lab5 remove wrk --- labs/lab5/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab5/readme.md b/labs/lab5/readme.md index b8fef3d..e839bec 100644 --- a/labs/lab5/readme.md +++ b/labs/lab5/readme.md @@ -1220,7 +1220,7 @@ With NGINX, there are several configuration options for this, but in this next l 1. If you need to find the `answers` to the lab exercises, you will find the final NGINX configuration files for all the exercises in the `labs/lab5/final` folder. Use them for reference to compare how you completed the labs. -1. If you are finished with this lab move to the next lab. Please donot shut down your test environment as you would be using the same environment in lab6. +1. If you are finished with this lab move to the next lab. Please do not shut down your test environment as you would be using the same environment in Lab6. **This completes Lab5.** From ff811344ed2d4dd3b945eccb586c3d08645f06a0 Mon Sep 17 00:00:00 2001 From: chrisakker Date: Wed, 12 Mar 2025 13:50:14 -0700 Subject: [PATCH 3/3] lab6 title change --- labs/lab6/readme.md | 6 +++--- labs/readme.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/labs/lab6/readme.md b/labs/lab6/readme.md index ee861c3..4f396fb 100644 --- a/labs/lab6/readme.md +++ b/labs/lab6/readme.md @@ -1,4 +1,4 @@ -# NGINX Plus Logs, Logging and Troubleshooting +# NGINX Plus Logs, Health Checks and API ## Introduction @@ -252,7 +252,7 @@ In this section, you will enable active Plus Healthchecks. Active healthchecks p 1. NGINX also records health check failures in the `/var/log/nginx/error.log` file which is symlinked to `/dev/stderr` within our docker setup. If you run below command you can see the error.log content. ```bash - docker log $NAME-nginx-plus + docker logs $NAME-nginx-plus ``` @@ -291,7 +291,7 @@ In this section, you will manage your backend servers dynamically using the NGIN 1. Start the `wrk` load generation tool by downloading and running the following docker container. ```bash - docker run --network=lab5_default --rm elswork/wrk -t4 -c200 -d20m -H 'Host: cafe.example.com' --timeout 2s http://$NAME-nginx-plus/coffee + docker run --network=lab5_default --rm elswork/wrk -t4 -c200 -d20m -H 'Host: cafe.example.com' --timeout 2s http://nginx-plus/coffee ``` diff --git a/labs/readme.md b/labs/readme.md index 89f6505..e51ed4c 100644 --- a/labs/readme.md +++ b/labs/readme.md @@ -69,8 +69,8 @@ Choose one of the [Lab 0: Workshop pre-work](#lab-0-workshop-pre-work-choose-any ### Lab 5: NGINX Reverse Proxy and HTTP Load Balancing - [Lab 5: NGINX Reverse Proxy and HTTP Load Balancing](lab5/readme.md) -### Lab 6: NGINX Plus Logs, Logging and Troubleshooting -- [Lab 6: NGINX Plus Logs, Logging and Troubleshooting](lab6/readme.md) +### Lab 6: NGINX Plus Logs, Health Checks and API +- [Lab 6: NGINX Plus Logs, Health Checks and API](lab6/readme.md) ### Lab 7: Monitoring NGINX Plus with Prometheus and Grafana - [Lab 7: Monitoring NGINX Plus with Prometheus and Grafana](lab7/readme.md)