# This file is for sysctl tuning of linux machines
# It should be placed in:
# /usr/lib/sysctl.d
# /etc/sysctl.d
#
#

# Kernel numa balancing moves tasks / memory to stay within a numa region
# This HUGELY improves performance.
# Does nothing on machines with a single numa region.
# kernel.numa_balancing = 1

# The swappiness parameter controls the tendency of the kernel to move
# processes out of physical memory and onto the swap disk.
# 0 tells the kernel to avoid swapping processes out of physical memory
# for as long as possible
# 100 tells the kernel to aggressively swap processes out of physical memory
# and move them to swap cache
vm.swappiness = 20

# Min free kbytes is how much the kernel keeps for "must work" allocations.
# This affects OOM, because as we approach, we'll threaten this space and we'll be
# booted.
# In some cases, adjusting this *may* help prevent oom.
# vm.min_free_kbytes=1024

# https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt

# Changes tcp window behavour to not reset window size after idle
# setting this to 0, so that resumed connections are "snappier".
net.ipv4.tcp_slow_start_after_idle = 0

# Allows sending data in the first SYN packet from connections we initiate and receive
# 1027 == 0x400 + 0x2 + 0x1
net.ipv4.tcp_fastopen=1027

# Provide more ports and timewait buckets to increase connectivity
net.ipv4.tcp_max_tw_buckets = 262144

## Network Hardening ##
net.ipv4.tcp_max_syn_backlog = 4096

# https://www.bufferbloat.net/projects/codel/wiki/

net.core.default_qdisc = fq_codel


