Skip to content

Lab5-6 updates to SE branch #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions labs/lab5/final/upstreams.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -15,18 +15,18 @@ 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;
server web2:80;
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;

}
12 changes: 6 additions & 6 deletions labs/lab5/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```

Expand Down Expand Up @@ -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.

<br/>

Expand Down Expand Up @@ -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

```

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.**

Expand Down
6 changes: 3 additions & 3 deletions labs/lab6/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NGINX Plus Logs, Logging and Troubleshooting
# NGINX Plus Logs, Health Checks and API

## Introduction

Expand Down Expand Up @@ -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

```

Expand Down Expand Up @@ -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

```

Expand Down
4 changes: 2 additions & 2 deletions labs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading