|
1 | 1 | --- |
2 | 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. |
3 | 4 | weight: 3 |
4 | 5 | layout: "learningpathall" |
5 | 6 | --- |
6 | 7 |
|
7 | | -## Kernel configuration |
| 8 | +## Optimize kernel network stack settings |
8 | 9 |
|
9 | 10 | 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. |
10 | 11 |
|
@@ -34,32 +35,25 @@ sudo sysctl -w net.ipv4.tcp_wmem="4096 8388608 8388608" |
34 | 35 |
|
35 | 36 | These values are intentionally large. Size them for your expected connection rate, request pattern, and available memory. |
36 | 37 |
|
37 | | -- `net.core.somaxconn`: |
38 | | - - 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 | | - - 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 set a value for this parameter. |
45 | | -- `net.core.wmem_max`: |
46 | | - - 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 set a value for this parameter. |
49 | | -- `net.ipv4.tcp_max_syn_backlog`: |
50 | | - - 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 | | - - 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 | | - - 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 set a value for this parameter. |
59 | | -- `net.ipv4.tcp_wmem`: |
60 | | - - 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 set 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. |
63 | 57 |
|
64 | 58 | ## Compiler considerations |
65 | 59 |
|
@@ -95,4 +89,4 @@ NGINX relies on [zlib](https://zlib.net/) for HTTP response compression when the |
95 | 89 |
|
96 | 90 | You've now learned about different kernel, compiler, and library optimizations that you can make to tune NGINX performance. |
97 | 91 |
|
98 | | -Next, you'll review the configuration for a static file server and learn about optimizations that you can make. |
| 92 | +Next, you'll review the configuration for a static file server and learn about optimizations that you can make. |
0 commit comments