How to tune up Ubuntu 18.04 64 bit server for maximum performance

March 9, 2020

We have been in this streaming business/IPTV for a long time, possibly the longest in the industry. During those years, we have learnt tuning up your Linux servers is the first step you should do before putting them into the production or even test environment. First log in SSH, then run those commands:

Tuning sysctl

Command: sudo nano /etc/sysctl.conf

Copy and paste this code at the bottom of the file

fs.inotify.max_user_instances=10485760
fs.inotify.max_user_watches=10485761
fs.nr_open=10485762
net.core.netdev_max_backlog=10485763
net.core.rmem_max=16777216
net.core.somaxconn=65535
net.core.wmem_max=16777216
net.ipv4.ip_local_port_range=1024 65535
net.ipv4.netfilter.ip_conntrack_max=10485764
net.ipv4.tcp_fin_timeout=5
net.ipv4.tcp_max_orphans=10485765
net.ipv4.tcp_max_syn_backlog=20480
net.ipv4.tcp_max_tw_buckets=400000
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_tw_reuse=1
fs.file-max = 20000000
net.ipv4.tcp_rmem= 1024000 8738000 1677721600
net.ipv4.tcp_wmem= 1024000 8738000 1677721600
net.ipv4.udp_mem =1024000 8738000 1677721600
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 5000
net.ipv4.route.flush=1

 

Save it and exit. Press Control O to save it, then Control X to exit.

Tuneup security limit

Type in this command: sudo nano /etc/security/limits.conf

*               soft    nofile          10485766
*               hard    nofile          10485767
root        soft    nofile          10485766
root        hard    nofile          10485767
*               soft    nproc          10485766
*               hard    nproc          10485767
*               soft    memlock         unlimited
*               hard    memlock         unlimited

Save it and exit. Press Control O to save it, then Control X to exit.

Tuneup security again.

Type in this command

sudo nano /etc/systemd/user.conf

and add:

DefaultLimitNOFILE=20485761

Save it and exit. Press Control O to save it, then Control X to exit.

the type in this command:

sudo nano /etc/systemd/system.conf

and add:

DefaultLimitNOFILE=20971521

Save it and exit. Press Control O to save it, then Control X to exit.

NOW REBOOT YOUR LINXU SERVER WITH COMMAND: reboot
YOUR SERVER IS TUNED UP AND READY TO SERVE TRAFFIC UP TO 10Gbps.