Difference between revisions of "Tuning the Server"

From SponsorBlock
Jump to navigation Jump to search
(more limits)
(Add postgres optimizations from RYD)
 
(3 intermediate revisions by one other user not shown)
Line 17: Line 17:
  net.ipv4.tcp_max_syn_backlog=3240000
  net.ipv4.tcp_max_syn_backlog=3240000


  net.core.netdev_max_backlog=10000
  net.core.netdev_max_backlog=70000
 
net.ipv4.tcp_max_orphans=70000
Lower timeout to allow more connections per second<ref>https://stackoverflow.com/a/3923785/1985387</ref>
net.ipv4.tcp_fin_timeout=20


==== Security limits ====
==== Security limits ====
Line 23: Line 27:
  *              soft    nofile          65535
  *              soft    nofile          65535
  *              hard    nofile          65535
  *              hard    nofile          65535
== Postgres ==
Autovacuum - 10mins <ref>https://discord.com/channels/603643120093233162/603643299961503761/958431436023672842</ref>
Hugepages for shared_memory buffers
syncronous_commits off <ref>https://discord.com/channels/603643120093233162/607338052221665320/961280147611353088</ref>

Latest revision as of 22:44, 6 April 2022

Increase ulimit

ulimit -n 65535

Sysctl

Increase the ports available

sysctl -w net.ipv4.ip_local_port_range="9000 65500"

And add this line to /etc/sysctl.conf

net.ipv4.ip_local_port_range=9000 65500

Increase max connections

sysctl -w net.core.somaxconn=324000

And add this line to /etc/sysctl.conf

net.core.somaxconn=324000
More limits
net.ipv4.tcp_max_syn_backlog=3240000
net.core.netdev_max_backlog=70000
net.ipv4.tcp_max_orphans=70000

Lower timeout to allow more connections per second[1]

net.ipv4.tcp_fin_timeout=20

Security limits

Add these lines to /etc/security/limits.conf

*               soft    nofile          65535
*               hard    nofile          65535

Postgres

Autovacuum - 10mins [2]

Hugepages for shared_memory buffers

syncronous_commits off [3]