Add GCC atomic support (-moutline-atomics) for arm64 on Focal
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
haproxy (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Focal |
Triaged
|
Undecided
|
Mitchell Dzurick | ||
nginx (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Focal |
In Progress
|
Undecided
|
Mitchell Dzurick | ||
postgresql-12 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Focal |
Triaged
|
Undecided
|
Mitchell Dzurick |
Bug Description
[ Impact ]
When using nginx on arm64, the CPU may go under heavy load and drop packets when being stressed.
A compile-time optimization to use hardware acceleration could be included to help alleviate the CPU utilization for systems that have atomic instructions available.
[ Test Plan ]
The test plan requires a decent amount of setup. This setup is covered in full at https:/
In short, the setup involves a focal based arm64 nginx server, 4 amd64 focal endpoints running a nodejs applicaiton, and 1 amd64 focal server to initiate the workloads.
This test is an E2E test which tests both functionality and performance improvements.
1) Set up the system as described in https:/
2) Initiate the workload on the DRV instance
$ ./wrk/wrk -t36 -c512 -d60s http://
3) While workload is running, capture results on SUT
$ sudo perf record -a -e r6e sleep 20s
4) After the test is ran, you should have metrics on both the DRV and SUT system.
5) Install new nginx with -moutline atomics
$ sudo add-apt-repository ppa:mitchdz/
$ sudo apt update
$ Sudo apt install -y nginx
$ dpkg -s nginx | grep Version
Version: 1.18.0-
6) ensure outline-atomics is installed (ctrl+f to see it, since this is not a user friendly wall of text)
$ nginx -V |& grep moutline
configure arguments: --with-cc-opt='-g -O2 -fdebug-
7) re-run wrk test as shown in steps 2-3
Results:
- without patch:
- wrk output:
```
ubuntu@
Running 1m test @ http://
36 threads and 512 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.14ms 2.03ms 211.63ms 72.12%
Req/Sec 4.67k 0.89k 23.92k 76.44%
10056815 requests in 1.00m, 5.20GB read
Requests/sec: 167336.42
Transfer/sec: 88.57MB
```
- STREX count: Samples: 4M of event 'r6e', Event count (approx.): 364457784
- SUT CPU utiliz: 100%
- with patch:
- wrk output:
```
ubuntu@
Running 1m test @ http://
36 threads and 512 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.02ms 1.04ms 210.87ms 99.52%
Req/Sec 13.94k 327.01 16.95k 79.69%
30006090 requests in 1.00m, 15.51GB read
Requests/sec: 499273.74
Transfer/sec: 264.26MB
```
- STREX count: No Samples
- SUT CPU utiliz: 20%
[ Where Problems Could Occur ]
Performance Trade-offs:
* While this will decrease the CPU load, it will increase the utilization of atomic operations.
* outlining atomics can make debugging more complicated, especially in the case of concurrency debugging.
* This improves application performance through offloading instructions. This can reveal bugs that were not possible before such as race conditions, deadlocks, or incorrect synchronization.
* This optimization adds a run-time check for the availability of atomic instructions. If atomics instructions are not found, ARMv8.0 compatible code is executed, so overhead will be added to systems that do not have atomic instructions.
[ Other Info ]
* Why is -moutline-atomics not enabled already?
Focal uses gcc-9 which does not enable -moutline-atomics by default. gcc-10 is when it became enabled by default.
https:/
vs
https:/
gcc-9 changelog showing the addition of -moutline-atomics: https:/
Here is the thread with the discussion to enable by default: https:/
A lengthy discussion also happened in Debian to include this flag by default - https:/
Related branches
- Canonical Server Reporter: Pending requested
- Ubuntu Sponsors: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 27 lines (+8/-0)2 files modifieddebian/changelog (+6/-0)
debian/rules (+2/-0)
- Łukasz Zemczak (community): Needs Information
- git-ubuntu import: Pending requested
-
Diff: 13 lines (+2/-0)1 file modifieddebian/rules (+2/-0)
tags: | added: server-todo |
tags: | added: server-triage-discuss |
tags: | removed: server-triage-discuss |
Changed in nginx (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → Low |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in nginx (Ubuntu): | |
assignee: | Mitchell Dzurick (mitchdz) → nobody |
Changed in haproxy (Ubuntu Focal): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in nginx (Ubuntu Focal): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in postgresql-12 (Ubuntu Focal): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in nginx (Ubuntu): | |
importance: | Low → Undecided |
Changed in nginx (Ubuntu): | |
status: | In Progress → New |
description: | updated |
Changed in haproxy (Ubuntu): | |
status: | New → Invalid |
Changed in haproxy (Ubuntu Focal): | |
status: | New → In Progress |
status: | In Progress → Triaged |
Changed in nginx (Ubuntu Focal): | |
status: | New → In Progress |
Changed in postgresql-12 (Ubuntu Focal): | |
status: | New → Triaged |
Changed in postgresql-12 (Ubuntu): | |
status: | New → Invalid |
Changed in nginx (Ubuntu): | |
status: | New → Invalid |
description: | updated |
I talked with Fabio (now subscribed), he will track and ensure this is done together with all the other "enable -moutline-atomics" cases.