Skip to content

Instantly share code, notes, and snippets.

@manchuck
Last active August 18, 2016 18:26
Show Gist options
  • Save manchuck/f6c654851c13362c39d398f45cc04d7e to your computer and use it in GitHub Desktop.
Save manchuck/f6c654851c13362c39d398f45cc04d7e to your computer and use it in GitHub Desktop.
Sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
################################
### Kernal / Memory settings ###
################################
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
# Increase system file descriptor limit
fs.file-max = 100000
# Discourage Linux from swapping idle processes to disk (default = 60)
vm.swappiness = 10
########################
### Network Settings ###
########################
# Increase the number of incomming connections
net.core.somaxconn = 4096
# Increase number of incoming connections backlog
net.core.netdev_max_backlog = 65563
#########################
## IPv4 / TCP Settings ##
#########################
# Increase Linux autotuning TCP buffer limits
# Set max to 16MB for 1GE and 32M (33554432) or 54M (56623104) for 10GE
# Don't set tcp_mem itself! Let the kernel scale it based on RAM.
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.optmem_max = 40960
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Allows scaling up TCP Windows to 16 MB
net.ipv4.tcp_wmem = 4096 12582912 16777216
net.ipv4.tcp_rmem = 4096 12582912 16777216
# Caches the tcp window for persistant connections (This is awesome sauce for HTTP)
net.ipv4.tcp_slow_start_after_idle = 0
# Make room for more TIME_WAIT sockets due to more clients,
# and allow them to be reused if we run out of sockets
# Also increase the max packet backlog
net.core.netdev_max_backlog = 50000
net.ipv4.tcp_max_syn_backlog = 30000
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10
# Restrict TCP Ports
net.ipv4.ip_local_port_range = 10240 65535
# Disable source routing and redirects
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
# Sets the number of
net.ipv4.tcp_fin_timeout = 10
# Tell the server to RST the connection on an over flow
# For the past 5 years I (MANCHUCK) have been on the fence about this
# as it forces the client connecting to try the connection again
net.ipv4.tcp_abort_on_overflow = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment