Linux sysctl



Kullanmış olduğum ve optimizasyon için işinize yarayabileceğini düşündüğümüz kernel parametreleri.

Virtual memory management

==
vm.swappiness
vm.overcommit_memory
vm.overcommit_ratio

# sysctl -w vm.overcommit_memory=1

Setting overcommit_memory to 1 says Linux to relax and perform the fork in a more optimistic allocation fashion.
A good source to understand how Linux Virtual Memory work and other alternatives for overcommit_memory andovercommit_ratio is this classic from Red Hat Magazine, "Understanding Virtual Memory". Beware, this article had1 and 2 configuration values for overcommit_memory reversed: refer to the proc(5) man page for the right meaning of the available values.

overcommit_memory is a value which sets the general kernel policy toward granting memory allocations. If the value is 0, then the kernel checks to determine if there is enough memory free to grant a memory request to a malloc call from an application. If there is enough memory, then the request is granted. Otherwise, it is denied and an error code is returned to the application. If the value is set to 1, then the kernel grants allocations above the amount of physical RAM and swap in the system as defined by theovercommit_ratio value. Enabling this feature can be somewhat helpful in environments which allocate large amounts of memory expecting worst case scenarios but do not use it all. If the setting in this file is 2, the kernel allows all memory allocations, regardless of the current memory allocation state.



Network

==

netdev_max_backlog
------------------

Maximum number  of  packets,  queued  on  the  INPUT  side, when the interface
receives packets faster than kernel can process them.
 

/proc/sys/net/core/rmem_max  (This sets the max OS send buffer size for all types of connections. syslog-ng optimizasyon sürecinde kullanıldı.),

/proc/sys/net/core/*
dev_weight - INTEGER
 The maximum number of packets that kernel can handle on a NAPI
 interrupt, it's a Per-CPU variable.

# echo 65536 > /proc/sys/net/core/dev_weight

optimize ethernet adapter ring buffers with:

# ethtool -G eth0 rx 8192 tx 8192

query:

# ethtool -g eth0

stats:

# cat /proc/net/dev


Multi-queue hashing algorithms:

GET:

# ethtool -n eth0 rx-flow-hash udp4
UDP over IPV4 flows use these fields for computing Hash flow key:
IP SA
IP DA

# ethtool -n eth0 rx-flow-hash tcp4
TCP over IPV4 flows use these fields for computing Hash flow key:
IP SA
IP DA
L4 bytes 0 & 1 [TCP/UDP src port]
L4 bytes 2 & 3 [TCP/UDP dst port]

SET for udp4 :
# ethtool -N eth0 rx-flow-hash udp4 sdfn

GET for udp4:
# ethtool -n eth0 rx-flow-hash udp4
UDP over IPV4 flows use these fields for computing Hash flow key:
IP SA
IP DA
L4 bytes 0 & 1 [TCP/UDP src port]
L4 bytes 2 & 3 [TCP/UDP dst port]

No comments:

Post a Comment