11### GENERAL SYSTEM SECURITY OPTIONS ###
22
3- # Disable SysRq keyboard shortcuts : Credit SlickStack
4- kernel.sysrq = 0
5-
63# Controls the number of system-wide asynchronous io requests
74fs.aio-max-nr = 1048576
85
@@ -41,11 +38,11 @@ kernel.kptr_restrict = 1
4138# Increase size of file handles and inode cache
4239fs.file-max = 209708
4340
44- ## Protect system hard/soft links : Credit SlickStack
41+ # Protect system hard/soft links : Credit SlickStack
4542fs.protected_hardlinks = 1
4643fs.protected_symlinks = 1
4744
48- ## Big performance boost (published by PostgreSQL community) : Credit SlickStack
45+ # Big performance boost (published by PostgreSQL community) : Credit SlickStack
4946kernel.sched_migration_cost_ns = 5000000
5047kernel.sched_autogroup_enabled = 0
5148
@@ -57,6 +54,9 @@ vm.dirty_background_ratio = 5
5754# Specifies the minimum virtual address that a process is allowed to mmap
5855vm.mmap_min_addr = 4096
5956
57+ # Specifies the maximum number of memory map areas that a process can have
58+ vm.max_map_count = 262144
59+
6060# 50% overcommitment of available memory
6161# Allow memory overcommit required for redis
6262vm.overcommit_ratio = 40
@@ -95,7 +95,7 @@ net.ipv6.conf.default.forwarding = 0
9595
9696# Disables IP source routing
9797net.ipv4.conf.all.send_redirects = 0
98- net.ipv4.conf.default.send_redirects = 0
98+ net.ipv4.conf.default.send_redirects = 0
9999net.ipv4.conf.all.accept_source_route = 0
100100net.ipv4.conf.default.accept_source_route = 0
101101net.ipv6.conf.all.accept_source_route = 0
@@ -123,9 +123,9 @@ net.ipv4.conf.default.log_martians = 1
123123net.ipv4.tcp_fin_timeout = 10
124124
125125# Decrease the time default value for connections to keep alive
126- net.ipv4.tcp_keepalive_time = 300
127- net.ipv4.tcp_keepalive_probes = 5
128126net.ipv4.tcp_keepalive_intvl = 15
127+ net.ipv4.tcp_keepalive_probes = 5
128+ net.ipv4.tcp_keepalive_time = 300
129129
130130# Don't relay bootp
131131net.ipv4.conf.all.bootp_relay = 0
@@ -136,7 +136,7 @@ net.ipv4.conf.all.proxy_arp = 0
136136# Turn on the tcp_timestamps, accurate timestamp make TCP congestion control algorithms work better
137137net.ipv4.tcp_timestamps = 1
138138
139- # # Enable select acknowledgments
139+ # Enable select acknowledgments
140140net.ipv4.tcp_sack = 1
141141
142142# Don't ignore directed pings
@@ -156,16 +156,16 @@ net.ipv6.ip_local_port_range = 1024 65535
156156net.ipv4.tcp_rfc1337 = 1
157157
158158# Do not auto-configure IPv6
159- net.ipv6.conf.all.autoconf=0
160- net.ipv6.conf.all.accept_ra=0
161- net.ipv6.conf.default.autoconf=0
162- net.ipv6.conf.default.accept_ra=0
163- net.ipv6.conf.eth0.autoconf=0
164- net.ipv6.conf.eth0.accept_ra=0
159+ net.ipv6.conf.all.accept_ra = 0
165160net.ipv6.conf.all.accept_ra_defrtr = 0
166- net.ipv6.conf.default.accept_ra_defrtr = 0
167161net.ipv6.conf.all.accept_ra_pinfo = 0
162+ net.ipv6.conf.all.autocon f = 0
163+ net.ipv6.conf.default.accept_ra = 0
164+ net.ipv6.conf.default.accept_ra_defrtr = 0
168165net.ipv6.conf.default.accept_ra_pinfo = 0
166+ net.ipv6.conf.default.autoconf = 0
167+ net.ipv6.conf.eth0.accept_ra = 0
168+ net.ipv6.conf.eth0.autoconf = 0
169169
170170### TUNING NETWORK PERFORMANCE ###
171171
@@ -207,17 +207,16 @@ net.core.somaxconn = 65535
207207# Increase number of incoming connections backlog
208208net.core.netdev_max_backlog = 32801
209209net.core.dev_weight = 64
210- net.core.netdev_budget = 1200
211- net.core.netdev_budget_usecs = 8000
210+ net.core.netdev_budget = 3600
211+ net.core.netdev_budget_usecs = 4000
212212
213213# Increase the maximum amount of option memory buffers
214214net.core.optmem_max = 25165824
215215
216216# Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
217- net.ipv4.tcp_max_tw_buckets = 400000
217+ net.ipv4.tcp_max_tw_buckets = 600000
218218
219219# Try to reuse time-wait connections, but don't recycle them (recycle can break clients behind NAT)
220- net.ipv4.tcp_tw_recycle = 0
221220net.ipv4.tcp_tw_reuse = 1
222221
223222# Limit number of orphans, each orphan can eat up to 16M (max wmem) of unswappable memory
@@ -275,6 +274,13 @@ net.ipv6.route.flush = 1
275274
276275# References
277276# https://wiki.archlinux.org/title/Sysctl
277+ # https://www.kernel.org/doc/Documentation/sysctl/
278+ # https://github.com/klaver/sysctl/blob/master/sysctl.conf
278279# https://medium.com/@moaminsharifi/tuning-your-linux-kernel-for-io-intensive-applications-2e059dd5f813
279280# https://ntk148v.github.io/posts/linux-network-performance-ultimate-guide/
280281# https://raw.githubusercontent.com/littlebizzy/slickstack/master/modules/ubuntu/24.04/sysctl.txt
282+ # https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/monitoring_and_managing_system_status_and_performance/tuning-the-network-performance_monitoring-and-managing-system-status-and-performance
283+ # https://bastakiss.com/blog/linux-7/best-practices-for-managing-linux-servers-in-2025-517
284+ # https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
285+ # https://discourse.ubuntu.com/t/boosting-the-vm-max-map-count-in-ubuntu/33863/7
286+ # https://fasterdata.es.net/host-tuning/linux/
0 commit comments