Linux Kernel IO Tuning Cheat Sheet - Presentation.pdf

AminSharifi8 70 views 12 slides Aug 04, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
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...


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

Amin Sharifi
Thank you!
Read more: https://medium.com/@moaminsharifi