Linux Kernel IO Tuning Cheat Sheet - Presentation.pdf
AminSharifi8
70 views
12 slides
Aug 04, 2024
Slide 1 of 12
1
2
3
4
5
6
7
8
9
10
11
12
About This Presentation
In today's data-driven landscape, optimizing the Linux kernel for I/O-intensive applications is crucial for achieving maximum performance. This presentation serves as a comprehensive cheat sheet for tuning various kernel parameters to boost throughput and reduce latency, ultimately enhancing the...
In today's data-driven landscape, optimizing the Linux kernel for I/O-intensive applications is crucial for achieving maximum performance. This presentation serves as a comprehensive cheat sheet for tuning various kernel parameters to boost throughput and reduce latency, ultimately enhancing the efficiency of your applications.
Key Areas of Focus
Kernel and Filesystem Parameters
kernel.pid_max: This parameter sets the maximum process ID value, allowing for more concurrent processes when increased.
fs.file-max: Defines the maximum number of file descriptors that can be allocated, impacting the number of open files.
Virtual Memory Parameters
vm.swappiness: Controls the kernel's aggressiveness in swapping inactive memory pages to disk. A lower value reduces swapping, enhancing performance.
vm.vfs_cache_pressure: Adjusts the kernel's tendency to reclaim memory used for caching directory and inode objects, with lower values favoring caching.
vm.min_free_kbytes: Sets the minimum amount of free physical memory, influencing overall system performance and responsiveness.
Network Parameters
net.core.rmem_max and net.core.wmem_max: These parameters define the maximum receive and send socket buffer sizes, respectively, which can significantly improve performance for high-throughput applications.
net.core.somaxconn: Increases the maximum number of connections that can be queued for acceptance by a listening socket, enhancing server responsiveness.
TCP and UDP Parameters
net.ipv4.tcp_rmem and net.ipv4.tcp_wmem: These settings allow for fine-tuning TCP receive and send buffer sizes, optimizing data flow.
net.ipv4.tcp_low_latency: Enables low-latency TCP mode, crucial for real-time applications by reducing packet delivery delays.
Security Considerations
Disabling ICMP redirect messages and source-routed packets enhances security, protecting against potential network attacks.
Conclusion
By understanding and adjusting these essential kernel parameters, system administrators and developers can significantly enhance the performance of I/O-intensive applications on Linux. This tuning not only boosts throughput and reduces latency but also ensures that systems remain responsive under high loads.
For a deeper dive into these optimizations and practical examples, check out https://medium.com/@moaminsharifi/tuning-your-linux-kernel-for-io-intensive-applications-2e059dd5f813
Size: 277.25 KB
Language: en
Added: Aug 04, 2024
Slides: 12 pages
Slide Content
Optimize
Linux kernel
settings for
maximum
performance
Boost
throughput
and reduce
latency
Enhance I/O-
intensive
applications
Essential
kernel
parameters
explained
Linux Kernel I/O
Tuning Cheat Sheet
1
Parameter Description
kernel.pid_max
Sets the maximum process ID value.
The default is usually 32768; increasing
it allows more concurrent processes.
fs.file-max
Defines the maximum number of file
descriptors that can be allocated by the
kernel. This affects the number of open
files.
2
Kernel and Filesystem Parameters
Parameter Description
KERNEL.PID_MAX
Defines the upper limit of process identifiers.
Increasing this value allows for a higher number of
concurrent processes.
FS.FILE-MAX
Specifies the maximum number of file descriptors
that can be opened simultaneously by the system.
VM.SWAPPINESS
Controls the kernel's aggressiveness in swapping out
inactive memory pages to disk. A lower value reduces
swapping.
Virtual Memory Parameters
3
Parameter Description
VM.VFS_CACHE_PRESSURE
Controls the tendency of the kernel to reclaim
memory used for caching directory and inode
objects. Lower values favor caching.
VM.MIN_FREE_KBYTES
Sets the minimum amount of free physical memory
(in kilobytes) the kernel attempts to maintain. This
influences overall system performance and
responsiveness.
Virtual Memory Parameters
4
Parameter Description
KERNEL.PID_MAX
Defines the upper limit of process identifiers.
Increasing this value allows for a higher number of
concurrent processes.
FS.FILE-MAX
Specifies the maximum number of file descriptors
that can be opened simultaneously by the system.
VM.SWAPPINESS
Controls the kernel's aggressiveness in swapping out
inactive memory pages to disk. A lower value reduces
swapping.
Virtual Memory Parameters
5
Parameter Description
VM.MIN_FREE_KBYTES
Sets the minimum amount of free physical memory
(in kilobytes) the kernel attempts to maintain. This
influences overall system performance and
responsiveness.
Virtual Memory Parameters
6
Parameter Description
NET.CORE.RMEM_MAX
Maximum receive socket buffer size for all
protocols. A larger value can improve performance
for high-throughput applications.
NET.CORE.WMEM_MAX
Maximum send socket buffer size for all protocols.
Similar to rmem_max, it helps with performance.
NET.CORE.RMEM_DEFAULT
Default receive socket buffer size for all protocols.
This is the size used when a socket is created
unless specified otherwise.
NET.CORE.WMEM_DEFAULT
Default send socket buffer size for all protocols.
Similar to rmem_default.
Network Parameters
7
Parameter Description
NET.CORE.NETDEV_BUDGET
Number of packets that can be processed in a
single interrupt. This can help with network
performance.
NET.CORE.OPTMEM_MAX
Maximum amount of memory that can be allocated
for socket options. This can affect performance for
applications using socket options.
NET.CORE.SOMAXCONN
Maximum number of connections that can be
queued for acceptance by a listening socket.
Increasing this can improve server responsiveness.
NET.CORE.NETDEV_MAX_BACKLOG
Maximum number of packets that can be queued on
the input side when the interface receives packets
faster than the kernel can process them.
Network Parameters
8
TCP and UDP Parameters
Parameter Description
NET.IPV4.TCP_RMEM
TCP receive buffer size settings. This is a triplet of
minimum, default, and maximum sizes for TCP
receive buffers.
NET.IPV4.TCP_WMEM
TCP send buffer size settings. This is a triplet of
minimum, default, and maximum sizes for TCP send
buffers.
NET.IPV4.TCP_LOW_LATENCY
Enables low-latency TCP mode, which reduces the
delay in packet delivery. Useful for real-time
applications.
NET.IPV4.TCP_ADV_WIN_SCALE
Controls the TCP window scaling factor. A value of 1
enables scaling, which allows for larger TCP windows.
9
TCP and UDP Parameters
Parameter Description
NET.IPV4.TCP_FIN_TIMEOUT
Time to wait for a final FIN packet before closing a
connection. Reducing this can help free up resources
more quickly.
NET.IPV4.UDP_RMEM_MIN
Minimum receive buffer size for UDP sockets. This
ensures that UDP sockets have enough buffer space
for incoming packets.
NET.IPV4.UDP_WMEM_MIN
Minimum send buffer size for UDP sockets. Similar to
udp_rmem_min.
NET.IPV4.CONF.ALL.SEND_REDIRECTS
Disables sending of ICMP redirect messages. This
can enhance security by preventing the system from
responding to certain types of network traffic.
9
TCP and UDP Parameters
Parameter Description
NET.IPV4.CONF.ALL.ACCEPT_REDIRECTS
Disables acceptance of ICMP redirect messages. This
is a security measure to prevent potential man-in-
the-middle attacks.
NET.IPV4.CONF.ALL.ACCEPT_SOURCE_RO
UTE
Disables acceptance of source-routed packets. This
is generally recommended for security reasons.
NET.IPV4.TCP_MTU_PROBING
Enables Path MTU discovery for TCP connections.
This helps to avoid fragmentation and can improve
performance.
10