Jika anda memang mau belajar Optimasi/ Tuning Server Ubuntu Squid Proxy untuk usaha warnet anda, menurut hemat saya anda tidak perlu Membayar seperti penawaran website tetanngga. Tetapi semua itu butuh ketekunan dan usaha untuk mencapai yang terbaik sesuai dengan apa yang kita inginkan.
Pada blog ini saya senang berbagi pengalaman yang telah saya lakukan untuk optimasi Ubuntu Squid agar lebih kenceng kirim data cache sesuai dengan client request. Saat ini warnet Ciputih Bogor menggunakan optimasi/ tuning ini saja dengan menggunakan resource yang seadanya yaitu:
Processor: P-III
Ram: 512 MB
Hardisk 1 = 20 GB
Hardisk 2 = 16 GB
Software : Ubuntu 12.04 TLd (terupdate 2012)
Alhamdulillah dapat berjalan dengan lancar cukup dapat membantu untuk cache browsing dan update game online PB, Ayodance, Crossfire dll. Apalagi jika anda punya PC yang lebih memadai untuk caching server, pasti lebih agresif untuk lempar data dan sedot data.
Anyway, sebelumnya partisi directory untuk cache dengan format BTRFS terlebih dahulu (pada saat proses instalasi Ubuntu), kemudian lakukan perintah dibawah ini:
# lsmod |grep -i btrfs
# nano /etc/fstab
Lalu set partisi cache seperti berikut:
# /cache btrfs noatime,compress,noacl 0 2
Mengoptimalkan Kernel Squid / Tuning Kernel:
Set default FD jadi 1024
cheek di console default FD yang ada berapa nilainya dengan perintah:
# ulimit -n
cara merubah dengan perintah:
# ulimit -HSn 65536
# echo "root soft nofile 65536" >> /etc/security/limits.conf
# echo "root hard nofile 65536" >> /etc/security/limits.conf
Tambahkan session required pam_limits.so pada /etc/pam.d/common-session
Lakukan perintah :
# modprobe ip_conntrack
Dan tambahkan ip_contrack pada file /etc/modules dengan perintah :
# nano etc/modules
Lalu sisipkan code dibawah ini didalamnya
ip_conntrack
Kemudian ubah /etc/sysctl.conf dengan code berikut Sysctl.conf:
# =================================
#sysclt.conf
# Locate /etc/sysctl.conf
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
#max openfiles
fs.file-max = 65536
#Minimalis use swap disk
vm.drop_caches = 3
vm.swappiness = 3
#kernel.shmall = 2097152
#kernel.shmmax = 2147483648
#kernel.shmmni = 4096
#kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
net.ipv4.tcp_low_latency = 1
net.core.netdev_max_backlog = 4000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 65536 4194304
#net.ipv4.tcp_rmem = 4096 87380 8388608
#net.ipv4.tcp_wmem = 4096 65536 8388608
net.core.wmem_max = 8388608
net.core.rmem_max = 8388608
net.ipv4.tcp_tw_recycle = 1
# Controls IP packet forwarding
net.ipv4.ip_forward = 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 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 use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queue
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
# =================================
Setelah itu check configurasi sysctl.conf lakukan dengan perintah
# sysctl -p
Kemudian tambahkan entri berikut pada file /etc/security/limits.conf
# nano /etc/security/limits.conf (tambahakan file dibawah)
* - nofile 65536
root soft nofile 65536
root hard nofile 65536
Selesai & reboot. Semoga anda berhasil.

