Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tuning stuff for Ubuntu hosts
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
===========================================================
# /etc/sysctl.conf
# sysctl for maximum tuning
# https://klaver.it/linux/sysctl.conf
# http://www.kegel.com/c10k.html
# http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1/
# https://gist.github.com/243632 - vmsappiness
# http://blog.urbanairship.com/blog/2010/09/29/linux-kernel-tuning-for-c500k/
# https://groups.google.com/forum/#!topic/nodejs/0Z34PH_R88o/discussion
# http://serverfault.com/questions/10852/what-limits-the-maximum-number-of-connections-on-a-linux-server
# http://fasterdata.es.net/fasterdata/host-tuning/linux/
# http://ubuntuforums.org/showthread.php?t=1198281
# Increase size of file handles and inode cache
fs.file-max = 999999
# Allowed local port range
net.ipv4.ip_local_port_range = 1024 65535
###
### TUNING NETWORK PERFORMANCE ###
###
# Do a 'modprobe tcp_cubic' first
net.ipv4.tcp_congestion_control = cubic
# Turn on the tcp_window_scaling
net.ipv4.tcp_window_scaling = 1
# Increase the maximum total buffer-space allocatable
# This is measured in units of pages (4096 bytes)
net.ipv4.tcp_mem = 65536 131072 262144
net.ipv4.udp_mem = 65536 131072 262144
# Increase the read-buffer space allocatable
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384
net.core.rmem_default = 87380
net.core.rmem_max = 16777216
# Increase the write-buffer-space allocatable
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384
net.core.wmem_default = 65536
net.core.wmem_max = 16777216
#############################
# General gigabit tuning:
#net.core.rmem_max = 16777216
#net.core.wmem_max = 16777216
#net.ipv4.tcp_rmem = 4096 87380 16777216
#net.ipv4.tcp_wmem = 4096 65536 16777216
#setting this to 1 -> possible SYN flooding on port 8080. Sending cookies.
net.ipv4.tcp_syncookies = 0
# this gives the kernel more memory for tcp
# which you need with many (100k+) open socket connections
net.ipv4.tcp_mem = 50576 64768 98152
net.core.netdev_max_backlog = 30000
# I was also masquerading the port comet was on, you might not need this
# net.ipv4.netfilter.ip_conntrack_max = 1048576
###############################
#
net.ipv4.tcp_max_tw_buckets = 360000
net.core.netdev_max_backlog = 2500
vm.min_free_kbytes = 65536
vm.swappiness = 0
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_orphan_retries = 1
net.ipv4.tcp_fin_timeout = 25
#raise this high
net.ipv4.tcp_max_orphans = 819200
# http://simonhf.wordpress.com/2010/10/01/node-js-versus-sxe-hello-world-complexity-speed-and-memory-usage/
net.core.somaxconn = 65535
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_max_syn_backlog = 20480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.