Skip to content

Commit 7f90c29

Browse files
Merge pull request #3451 from anupras-mohapatra-arm/servers-and-cloud-computing
NGINX tuning LP review
2 parents 33b4edf + e30b1ca commit 7f90c29

8 files changed

Lines changed: 199 additions & 126 deletions

File tree

content/learning-paths/servers-and-cloud-computing/nginx_tune/_index.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,58 @@ learning_objectives:
1515
prerequisites:
1616
- A cloud or bare-metal installation of an NGINX file server, reverse proxy, or API gateway.
1717
- A repeatable HTTP workload or load test that you can run before and after tuning.
18-
- If you do not already have an NGINX setup, review [Learn how to deploy NGINX](/learning-paths/servers-and-cloud-computing/nginx/).
18+
- If you don't already have an NGINX setup, see [Learn how to deploy NGINX](/learning-paths/servers-and-cloud-computing/nginx/).
19+
20+
# START generated_summary_faq
21+
generated_summary_faq:
22+
template_version: summary-faq-v3
23+
generated_at: '2026-06-30T15:49:37Z'
24+
generator: ai
25+
ai_assisted: true
26+
ai_review_required: true
27+
model: gpt-5
28+
prompt_template: summary-faq-v3
29+
source_hash: 39f9323dac9bd7f5480e501ad8fd93d2d9999c420ed1c2eb45eba2ccb3be63ad
30+
summary_generated_at: '2026-06-30T15:49:37Z'
31+
summary_source_hash: 39f9323dac9bd7f5480e501ad8fd93d2d9999c420ed1c2eb45eba2ccb3be63ad
32+
faq_generated_at: '2026-06-30T15:49:37Z'
33+
faq_source_hash: 39f9323dac9bd7f5480e501ad8fd93d2d9999c420ed1c2eb45eba2ccb3be63ad
34+
summary: >-
35+
You'll learn how to tune NGINX on Arm-based platforms using a measurement-first
36+
workflow. Using a baseline, you'll iteratively adjust Linux network stack parameters and
37+
evaluate compiler and library choices such as OpenSSL, PCRE, and zlib. You'll review tuned configuration examples and guidance for sizing directives to refine configurations
38+
for static file serving, reverse proxy, and API gateway scenarios. You'll also learn about `wrk`
39+
as an option for generating traffic and reporting throughput and latency on NGINX. By the end, you'll use `wrk` to compare before-and-after results and verify the impact of each tuning change.
40+
faqs:
41+
- question: How do I know whether a tuning change improved performance?
42+
answer: >-
43+
Re-run the same repeatable workload and compare throughput and latency before and after
44+
the change. Adjust one parameter at a time or use a designed experiment so results are attributable
45+
to specific settings.
46+
- question: Where do I change Linux network parameters when tuning?
47+
answer: >-
48+
Modify settings in /etc/sysctl.conf or use the sysctl command. Refer to the Linux kernel
49+
sysctl documentation, and treat these changes as part of the same measurement process used
50+
for NGINX directives.
51+
- question: Do I need to use wrk if I already have a load test?
52+
answer: >-
53+
No. If you already have a repeatable HTTP workload, use that. wrk is provided as a starting point
54+
only when you don't already have an established test method.
55+
- question: When tuning the reverse proxy or API gateway, what should I reuse from the static
56+
file server configuration?
57+
answer: >-
58+
Use the same top-level nginx.conf from the static file server section. Then apply the tuned
59+
reverse proxy and API gateway configuration and validate the result with repeatable measurements.
60+
- question: How do compiler, OpenSSL, PCRE, and zlib choices factor into tuning?
61+
answer: >-
62+
Evaluate these choices as part of your experiments because they can affect NGINX performance.
63+
Compare alternatives using the same workload and interpret results alongside your NGINX
64+
and kernel changes.
65+
# END generated_summary_faq
1966

2067
author: Julio Suarez
2168

22-
generate_summary_faq: true
69+
generate_summary_faq: false
2370
rerun_summary: false
2471
rerun_faqs: false
2572

@@ -73,3 +120,4 @@ weight: 1 # _index.md always has weight of 1 to order corr
73120
layout: "learningpathall" # All files under learning paths have this same wrapper
74121
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
75122
---
123+
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
2-
title: "Measure NGINX tuning impact"
2+
title: Measure the impact of NGINX tuning
33
description: Learn how to approach NGINX performance tuning as a measurement-driven process and compare baseline results with tuned results.
44
weight: 2
55
layout: "learningpathall"
66
---
77

88
## About performance tuning
99

10-
Performance tuning is most useful when you treat it as a measurement process, not a fixed checklist. You can tune by changing one parameter at a time, running a designed experiment, comparing profiles, or using automation and AI-assisted tools to explore a larger configuration space.
10+
Performance tuning is most useful when you treat it as a measurement process, not a fixed checklist. You can tune by changing one parameter at a time, or by running a designed experiment. You can compare profiles, or use automation and AI-assisted tools to explore a larger configuration space.
1111

12-
There isn't a universal set of tuning parameters that works best for every application. The right settings depend on the request profile, response size, TLS configuration, cache behavior, upstream service behavior, network path, software version, system architecture, operating system, and other application-specific factors.
12+
There isn't a universal set of tuning parameters that works best for every application. The right settings depend on factors such as the request profile, response size, TLS configuration, and cache behavior. Upstream service behavior, network path, software version, system architecture, operating system, and other application-specific factors can also affect performance.
1313

1414
Whatever method you use, keep the measurements repeatable. Record the system configuration, workload, software versions, and tuning parameters so you can identify which changes improved performance and which changes had little effect.
1515

1616
## Why tune NGINX
1717

18-
NGINX performance can be limited by connection handling, kernel network settings, TLS processing, file I/O, upstream connection reuse, cache behavior, logging, or regular expression processing. Tuning helps you use the available compute, memory, storage, and network resources more efficiently.
18+
NGINX performance can be limited by connection handling, kernel network settings, TLS processing, file I/O, upstream connection reuse, cache behavior, logging, or regular expression processing. By tuning, you can use the available compute, memory, storage, and network resources more efficiently.
1919

2020
Improved performance can give you higher throughput, lower latency, or better cost efficiency. A tuned configuration can increase capacity on the same system, or help you meet the same performance target with fewer compute resources.
2121

@@ -26,3 +26,9 @@ The following example shows `wrk` throughput before and after tuning for an NGIN
2626
![Bar chart comparing normalized NGINX API gateway wrk throughput before and after tuning. The out-of-box configuration is normalized to 1.00, and the tuned configuration reaches 1.13, showing about 13% higher RPS after tuning.#center](nginxoobvstuned.png "NGINX API gateway throughput before and after tuning")
2727

2828
This result is an example, not a guaranteed improvement for every workload. Your results depend on the NGINX version, request rate, response size, TLS settings, client concurrency, upstream services, network configuration, and system resources.
29+
30+
## What you've learned and what's next
31+
32+
You've now learned why tuning NGINX is useful and reviewed an example benchmark demonstrating improvement in `wrk` throughput after tuning.
33+
34+
Next, you'll learn about Linux network settings, compiler options, and supporting libraries that can affect NGINX performance.
Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
2-
title: "Kernel, compiler, and libraries"
2+
title: Tune kernel, compiler, and library settings for performance
3+
description: Tune Linux network settings and evaluate compiler, OpenSSL, PCRE, and zlib choices that can affect NGINX performance on Arm-based platforms.
34
weight: 3
45
layout: "learningpathall"
56
---
67

7-
## Kernel configuration
8+
## Optimize kernel network stack settings
89

910
NGINX tuning doesn't stop at `nginx.conf`. Foundational settings such as kernel network queues, socket buffers, compiler choices, and TLS libraries can affect throughput and latency. Treat these settings as part of the same measurement process you use for NGINX directives.
1011

@@ -34,55 +35,58 @@ sudo sysctl -w net.ipv4.tcp_wmem="4096 8388608 8388608"
3435

3536
These values are intentionally large. Size them for your expected connection rate, request pattern, and available memory.
3637

37-
* `net.core.somaxconn`:
38-
* This setting selects the maximum number of queued connections the kernel allows.
39-
* If the NGINX server needs to support a large number of clients, it can be helpful to increase this parameter.
40-
* A value of 65535 is likely excessive for many deployments. In practice, this value needs to be large enough to support the peak number of queued connections.
41-
* `net.core.rmem_max`:
42-
* This setting selects the maximum read socket buffer size.
43-
* `8 MiB` is likely more than enough for most use cases.
44-
* Use a tool such as `ss` to check socket buffer utilization and select a value for this parameter.
45-
* `net.core.wmem_max`:
46-
* This setting selects the maximum write socket buffer size.
47-
* `8 MiB` is likely more than enough for most use cases.
48-
* Use a tool such as `ss` to check socket buffer utilization and select a value for this parameter.
49-
* `net.ipv4.tcp_max_syn_backlog`:
50-
* This setting selects the maximum number of connection requests that are pending but not established yet.
51-
* A value of 65535 is likely excessive for many deployments. In practice, this value needs to be large enough to support the peak number of pending connection requests.
52-
* `net.ipv4.ip_local_port_range`:
53-
* This setting selects the range of local ports the kernel can use.
54-
* The example expands the port range. The default range is sufficient for many deployments.
55-
* `net.ipv4.tcp_rmem`:
56-
* This setting selects the TCP read socket buffer size.
57-
* `8 MiB` is likely more than enough for most use cases.
58-
* Use a tool such as `ss` to check TCP buffer utilization and select a value for this parameter.
59-
* `net.ipv4.tcp_wmem`:
60-
* This setting selects the TCP write socket buffer size.
61-
* `8 MiB` is likely more than enough for most use cases.
62-
* Use a tool such as `ss` to check TCP buffer utilization and select a value for this parameter.
38+
- `net.core.somaxconn`: Selects the maximum number of queued connections the kernel allows. If the NGINX server needs to support a large number of clients, it can be helpful to increase this parameter.
39+
40+
A value of 65535 is likely excessive for many deployments. In practice, this value needs to be large enough to support the peak number of queued connections.
41+
- `net.core.rmem_max`: Selects the maximum read socket buffer size. `8 MiB` is likely more than enough for most use cases.
42+
43+
Use a tool such as `ss` to check socket buffer utilization and set a value for this parameter.
44+
- `net.core.wmem_max`: Selects the maximum write socket buffer size. `8 MiB` is likely more than enough for most use cases.
45+
46+
Use a tool such as `ss` to check socket buffer utilization and set a value for this parameter.
47+
- `net.ipv4.tcp_max_syn_backlog`: Selects the maximum number of connection requests that are pending but not established yet.
48+
49+
A value of 65535 is likely excessive for many deployments. In practice, this value needs to be large enough to support the peak number of pending connection requests.
50+
- `net.ipv4.ip_local_port_range`: Selects the range of local ports the kernel can use. The example expands the port range. The default range is sufficient for many deployments.
51+
- `net.ipv4.tcp_rmem`: Selects the TCP read socket buffer size. `8 MiB` is likely more than enough for most use cases.
52+
53+
Use a tool such as `ss` to check TCP buffer utilization and set a value for this parameter.
54+
- `net.ipv4.tcp_wmem`: Selects the TCP write socket buffer size. `8 MiB` is likely more than enough for most use cases.
55+
56+
Use a tool such as `ss` to check TCP buffer utilization and set a value for this parameter.
6357

6458
## Compiler considerations
6559

66-
If you build NGINX from source, the compiler version and optimization flags can affect performance. Use a recent version of GCC, and consider flags such as `-mcpu` and `-flto` for additional optimization. These flags are explained in the [Migrating C/C++ applications](/learning-paths/servers-and-cloud-computing/migration/c/) section of the [Migrating applications to Arm servers](/learning-paths/servers-and-cloud-computing/migration/) Learning Path.
60+
If you build NGINX from source, the compiler version and optimization flags can affect performance. Use a recent version of GCC, and consider flags such as `-mcpu` and `-flto` for additional optimization. For more information about these flags, see the [Migrating C/C++ applications](/learning-paths/servers-and-cloud-computing/migration/c/) section of the [Migrating applications to Arm servers](/learning-paths/servers-and-cloud-computing/migration/) Learning Path.
6761

6862
When you configure an NGINX source build, pass compiler flags with the `--with-cc-opt` option.
6963

70-
To understand how to configure an NGINX build, review the [build NGINX from source](/learning-paths/servers-and-cloud-computing/nginx/build_from_source/) section of the [Learn how to deploy NGINX](/learning-paths/servers-and-cloud-computing/nginx/) Learning Path.
64+
To understand how to configure an NGINX build, see the [build NGINX from source](/learning-paths/servers-and-cloud-computing/nginx/build_from_source/) section of the [Learn how to deploy NGINX](/learning-paths/servers-and-cloud-computing/nginx/) Learning Path.
7165

7266
## OpenSSL
7367

7468
NGINX relies on [OpenSSL](https://www.openssl.org/) for cryptographic operations. The OpenSSL version, GCC version, and compiler switches used to build OpenSSL can affect TLS performance. The Linux distribution default version of OpenSSL is sufficient for many deployments.
7569

7670
Newer versions of OpenSSL might improve performance for some TLS workloads. To use a specific OpenSSL source tree, pass the `--with-openssl` switch when configuring the NGINX build. Point this switch to the directory that contains the source code of the OpenSSL version you want NGINX to link to. You can also use `--with-openssl-opt` to pass options to the OpenSSL build.
7771

78-
NGINX can also be built with OpenSSL-compatible alternatives for some use cases. For example, the NGINX [QUIC and HTTP/3 documentation](https://nginx.org/en/docs/quic.html) shows how to configure NGINX with BoringSSL, LibreSSL, or QuicTLS. Consider this when you have a specific TLS or QUIC reason to evaluate another library, and measure the result with your workload.
72+
You can also build NGINX with OpenSSL-compatible alternatives for some use cases. For example, the NGINX [QUIC and HTTP/3 documentation](https://nginx.org/en/docs/quic.html) shows how to configure NGINX with BoringSSL, LibreSSL, or QuicTLS. Consider this when you have a specific TLS or QUIC reason to evaluate another library, and measure the result with your workload.
7973

8074
Run `nginx -V` to check the TLS library information and configure options used by your NGINX build.
8175

8276
## Perl Compatible Regular Expressions (PCRE)
8377

84-
NGINX relies on [PCRE](https://www.pcre.org/) for regular expression processing. One scenario where regular expressions are used is an API gateway path rewrite. The Linux distribution default version of PCRE is sufficient for many deployments. A newer version of PCRE might improve performance for regular expression-heavy configurations. The NGINX [installation instructions](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#compiling-and-installing-from-source) explain how to build PCRE with NGINX from source.
78+
NGINX relies on [PCRE](https://www.pcre.org/) for regular expression processing. One scenario where regular expressions are used is an API gateway path rewrite. The Linux distribution default version of PCRE is sufficient for many deployments. A newer version of PCRE might improve performance for regular expression-heavy configurations.
79+
80+
To learn how to build PCRE with NGINX from source, see the NGINX [installation instructions](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#compiling-and-installing-from-source).
8581

8682
## zlib for HTTP response compression
8783

88-
NGINX relies on [zlib](https://zlib.net/) for HTTP response compression when the `ngx_http_gzip_module` directives are used. The Linux distribution default version of zlib is sufficient for many deployments. A newer version of zlib might improve performance for compression-heavy workloads. The NGINX [installation instructions](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#compiling-and-installing-from-source) explain how to build zlib with NGINX from source.
84+
NGINX relies on [zlib](https://zlib.net/) for HTTP response compression when the `ngx_http_gzip_module` directives are used. The Linux distribution default version of zlib is sufficient for many deployments. A newer version of zlib might improve performance for compression-heavy workloads.
85+
86+
To learn how to build zlib with NGINX from source, see the NGINX [installation instructions](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#compiling-and-installing-from-source).
87+
88+
## What you've learned and what's next
89+
90+
You've now learned how Linux network settings, compiler options, and supporting libraries can affect NGINX throughput and latency.
91+
92+
Next, you'll review the configuration for a static file server and learn about optimizations that you can make.

0 commit comments

Comments
 (0)