Skip to content

Commit 4536710

Browse files
committed
Update performance monitoring section: change title, remove AMD references, and add wrk and btop usage instructions
1 parent 14e27d1 commit 4536710

2 files changed

Lines changed: 105 additions & 29 deletions

File tree

content/learning-paths/servers-and-cloud-computing/multiarch_nginx_on_aks/3-deploy-arm.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,22 @@ layout: learningpathall
1010

1111
In this section, you'll add nginx on ARM nodes to your existing cluster, completing your multi-architecture Intel/ARM environment for comprehensive performance comparison.
1212

13-
The **arm_nginx.yaml** file creates the following K8s objects:
13+
### A quick note on Arm vs Intel nginx configurations
14+
15+
The only difference between the Arm and Intel nginx configs is the presence of these two lines in the Arm config:
16+
17+
```output
18+
worker_processes 2
19+
worker_cpu_affinity 01 10
20+
```
21+
22+
Why are they there? ARM's physical cores operate most efficiently when each has a dedicated worker thread with no interruptions. Intel's hyperthreaded cores work best when threads can flexibly be assigned across logical cores.
23+
24+
Nginx on Arm performs optimally when these values are explicitly set. Intel performs best when these two values are left at *auto*, which is the default in the Intel-version of the nginx configuration.
25+
26+
## Continuing with Arm K8s Configuration
27+
28+
When applied, the **arm_nginx.yaml** file creates the following K8s objects:
1429
- **ConfigMap** (`nginx-arm-config`) - Contains performance-optimized nginx configuration with ARM-specific tuning
1530
- **Deployment** (`nginx-arm-deployment`) - Pulls the multi-architecture nginx image from DockerHub, launches a pod on the ARM node, and mounts the ConfigMap as `/etc/nginx/nginx.conf`
1631
- **Service** (`nginx-arm-svc`) - Load balancer targeting pods with both `app: nginx-multiarch` and `arch: arm` labels

content/learning-paths/servers-and-cloud-computing/multiarch_nginx_on_aks/5-apply-configuration.md

Lines changed: 89 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,15 @@ The `nginx_util.sh` script includes a `put config` command that will:
3030

3131
You will see output similar to the following:
3232

33-
```outputI
34-
Applying custom nginx.conf to all nginx pods...
35-
configmap/nginx-config created
36-
Updating nginx-amd-deployment...
37-
deployment.apps/nginx-amd-deployment patched
38-
Updating nginx-arm-deployment...
39-
deployment.apps/nginx-arm-deployment patched
40-
Updating nginx-intel-deployment...
41-
deployment.apps/nginx-intel-deployment patched
42-
Waiting for pods to restart with new configuration...
33+
```output
4334
Installing btop on all nginx pods...
4435
Installing btop on nginx-amd-deployment-56b547bb47-vgbjj...
4536
✓ btop installed on nginx-amd-deployment-56b547bb47-vgbjj
4637
Installing btop on nginx-arm-deployment-66cb47ddc9-fgmsd...
4738
✓ btop installed on nginx-arm-deployment-66cb547ddc9-fgmsd
4839
Installing btop on nginx-intel-deployment-6f5bff9667-zdrqc...
4940
✓ btop installed on nginx-intel-deployment-6f5bff9667-zdrqc
50-
Custom nginx.conf applied and btop installed on all pods!
41+
✅ btop installed on all pods!
5142
```
5243

5344
### Verify configuration updates
@@ -60,46 +51,116 @@ kubectl get pods -n nginx
6051

6152
You should see all pods with recent restart times.
6253

54+
{{% notice Note %}}
55+
Because pods are ephemeral, btop will need to be reinstalled if the pods are deleted or restarted. If you get an error saying btop is not found, simply rerun the `./nginx_util.sh put btop` command to reinstall it.
56+
{{% /notice %}}
6357

64-
4. Verify btop is installed and available on both Arm and Intel pods:
6558

66-
```bash
67-
kubectl exec -n nginx $(kubectl get pods -l arch=intel -n nginx -o name | sed 's/pod\///') -- btop --version
68-
kubectl exec -n nginx $(kubectl get pods -l arch=arm -n nginx -o name | sed 's/pod\///') -- btop --version
69-
```
59+
### Monitor pod performance
7060

71-
You should see btop version information for both pods.
61+
You can now login to any pod and use btop to monitor system performance. There are many variables which may affect an individual workload's performance, btop (like top), is a great first step in understanding those variables.
7262

7363
{{% notice Note %}}
74-
Because pods are ephemeral, btop will need to be reinstalled if the pods are deleted or restarted in the future. If you get an error saying btop is not found, simply rerun the `./nginx_util.sh put btop` command to reinstall it.
64+
When performing load generation tests from your laptop, local system and network settings may interfere with proper load generation between your machine and the remote cluster services. To mitigate these issues, its suggested to install the nginx_util.sh (or whichever tool you wish to use) on a [remote Azure instance](https://learn.arm.com/learning-paths/servers-and-cloud-computing/csp/azure/) in the same region and zone as your K8s cluster (us-west-2 if you follow these tutorial instructions exactly) for best results. If you aren't seeing at least 70K+ requests/s to either K8s service endpoint, switching to a better located/tuned system is advised.
7565
{{% /notice %}}
7666

67+
Bringing up two btop terminals, one for each pod, is a convenient way to view performance in realtime. To bring up btop on both Arm and Intel pods:
7768

78-
### Monitor pod performance
79-
80-
5. You can now login to any pod and use btop to monitor system performance:
69+
1. Open a new terminal window or tab.
70+
2. Within the terminal, run the `login arm` command from the nginx utility script to enter the pod:
8171

8272
```bash
8373
# Login to AMD pod (replace with intel or arm as needed)
8474
./nginx_util.sh login arm
8575
```
8676

87-
Once inside the pod, run btop to see real-time system monitoring:
77+
3. Once inside the pod, run btop to see real-time system monitoring:
8878

8979
```bash
90-
btop
80+
btop --utf-force
9181
```
82+
4. Repeat, from Step 1, but this time, using the `login intel` command.
83+
84+
You should now see something similar to below, that is, one terminal for each Arm and Intel, running btop:
9285

93-
With btop open on the remote pod, from your local machine, run wrk against the pod to generate load. The nginx_util.sh script includes a wrk wrapper command that makes it easy to use the wrk utility to load test an endpoint:
86+
![Project Overview](images/btop_idle.png)
87+
88+
To visualize performance with btop against the Arm and Intel pods via the load balancer service endpoints, you can use the nginx_util.sh wrapper to generate the load two both simultaneoulsy:
9489

9590
```bash
96-
./nginx_util.sh wrk arm
91+
./nginx_util.sh wrk both
92+
```
93+
94+
This runs wrk with predefined setting (1 thread, 50 simultaneous connections) to generate load to the K8s architecture-specific endpoints. While it runs (for a default of 30s), you can observe some performance characteristics from the btop outputs:
95+
96+
![Project Overview](images/under_load.png)
97+
98+
Of particular interest is memory and CPU resource usage per pod. For Intel, figure 1 shows memory usage for the process, with figure 2 showing total cpu usage. Figures 3 and 4 show us the same metrics, but for Arm.
99+
100+
![Project Overview](images/mem_and_cpu.png)
101+
102+
In addition to the visual metrics, the script also returns runtime results including requests per second, and latencies:
103+
104+
```output
105+
azureuser@gcohen-locust-1:/tmp/1127$ ./nginx_util.sh wrk both
106+
Running wrk against both architectures in parallel...
107+
108+
Intel: wrk -t1 -c50 -d30 http://172.193.227.195/
109+
ARM: wrk -t1 -c50 -d30 http://20.252.73.72/
110+
111+
========================================
112+
113+
INTEL RESULTS:
114+
Running 30s test @ http://172.193.227.195/
115+
1 threads and 50 connections
116+
Thread Stats Avg Stdev Max +/- Stdev
117+
Latency 752.40us 1.03ms 28.95ms 94.01%
118+
Req/Sec 84.49k 12.14k 103.08k 73.75%
119+
2528743 requests in 30.10s, 766.88MB read
120+
Requests/sec: 84010.86
121+
Transfer/sec: 25.48MB
122+
123+
ARM RESULTS:
124+
Running 30s test @ http://20.252.73.72/
125+
1 threads and 50 connections
126+
Thread Stats Avg Stdev Max +/- Stdev
127+
Latency 621.56us 565.90us 19.75ms 95.43%
128+
Req/Sec 87.54k 10.22k 107.96k 82.39%
129+
2620567 requests in 30.10s, 789.72MB read
130+
Requests/sec: 87062.21
131+
Transfer/sec: 26.24MB
132+
133+
========================================
134+
Both tests completed
97135
```
98136

137+
### Experimenting with wrk
138+
139+
The nginx_util.sh script shows the results of the load generation, as well as the command lines used to generate them.
140+
141+
```output
142+
...
143+
Intel: wrk -t1 -c50 -d30 http://172.193.227.195/
144+
ARM: wrk -t1 -c50 -d30 http://20.252.73.72/
145+
...
146+
```
147+
148+
149+
Feel free to experiment increasing/decreasing client threads, connections, and durations to better understand the performance characteristics under different scenarios.
150+
151+
For example, to generate load using 500 connections across 4 threads to the Arm service for five minutes (300s), you could use the following commandline:
152+
153+
```bash
154+
wrk -t4 -c500 -d300 http://20.252.73.72/
155+
```
156+
157+
As mentioned earlier, unless your local system is tuned to handle load generation, you may find better traffic generation results by running on a VM. If aren't seeing at least 70K+ requests/s to either K8s service endpoint when running `wrk`, switching to a better located/tuned system is advised.
99158

100-
Press `q` to quit btop when finished.
159+
## Next Steps
101160

102-
### Test services still work
161+
You learned in this learning path how to run a sample nginx workload on a dual-architecture (Arm and Intel) Azure Kubernetes Service. Once setup, you learned how to generate load with the wrk utility, and monitor runtime metrics with btop. If you wish to continue experimenting with this learning path, some ideas you may wish to explore include:
103162

163+
* What do the performance curves look like between the two architectures as a function of load?
164+
* How do larger instance types scale versus smaller ones?
104165

105-
You have successfully applied performance optimizations and monitoring tools to your multi-architecture nginx cluster!
166+
Most importantly, you now possess the knowledge needed to begin experimenting with your own workloads on Arm-based AKS nodes to identify performance and efficiency opportunities unique to your own environments.

0 commit comments

Comments
 (0)