Tuning Kernel FreeBSD for optimation Squid

For optimation Squid Proxy with FreeBSD is tuning the kernel with some following option.

options MAXFILES=4096
options NMBCLUSTERS=10240

options MSGMNB=16384
options MSGMNI=42
options MSGSEG=2049
options MSGSSZ=64
options MSGTQL=2048

options SHMSEG=64
options SHMMNI=96
options SHMMAX=2097152
options SHMALL=4096

options MAXDSIZ="(384*1024*1024)"
options DFLDSIZ="(384*1024*1024)"
options MAXSSIZ="(256*1024*1024)"


also for mountimg partition cache in /etc/fstab is better if add the option noatime
For Configure options same within Linux, Optimalisation cache_dir with option diskd

In sysctl.conf add this option

kern.maxusers=384
kern.ipc.nmbuf=20480
kern.ipc.nmbclusters=32768
vfs.vmiodirenable=1
kern.ipc.maxsockbuf=2097152
kern.ipc.somaxconn=8192
kern.ipc.maxsockbuf=1048576
kern.ipc.maxsockets=16424
kern.maxfiles=65536
kern.maxfilesperproc=32768
net.inet.tcp.rfc1323=1
net.inet.tcp.delayed_ack=0
net.inet.tcp.sendspace=65535
net.inet.tcp.recvspace=65535
net.inet.udp.recvspace=65535
net.inet.udp.maxdgram=57344
net.local.stream.recvspace=65535
net.local.stream.sendspace=65535
net.inet.icmp.icmplim=300
net.inet.icmp.icmplim_output=0
net.inet.tcp.delayed_ack=0
net.inet.ip.portrange.last=40000

Or if your kernel will to compile, maybe this value can to encrease until 70 % or approriate with your memori computer. this configuration for sample for memory computer 512MB, once again if the computer dedicated for squid ;)

options MAXFILES=4096
options NMBCLUSTERS=10240

options MAXDSIZ="(384*1024*1024)"
options DFLDSIZ="(384*1024*1024)"
options MAXSSIZ="(256*1024*1024)"

become for :

maxusers 384
options NBUF=20480
options MAXFILES=65536
options NMBCLUSTERS=32768
options MAXDSIZ="(640*1024*1024)"
options DFLDSIZ="(640*1024*1024)"
options MAXSSIZ="(512*1024*1024)"

(mungkin jika setelah berjalan 1 bulan dg beban penuh dan ternyata memori belum mulai swap ke hardisk angkanya bisa dinaikkan lagi mjd 768,768,640, tapi jangan setinggi memori fisiknya lho)

dg opsi kompilasi (optimasi):

COPTFLAGS="-O2 -pipe"

dan semua module masuk ke kernel (NO_MODULES=true) (NFS, mouse, usb, pseudo device, debug/verbose support, dll/non-esensial jika memang tidak diperlukan dimatikan saja biar jadi 'extra langsing dan singset' kayak atlit sprinter, he he he ...).

Terus layanan non-esensial dimatikan saja, cron, inetd, and sendmail, dll di /etc/rc.conf (dari contoh Squid bake-off). http://www.squid-cache.org/Benchmarking/bakeoff-02/SQUID.txt. Kalau bisa periferal yg tidak diperlukan dimatikan juga di BIOS-nya (mis. serial/parallel port, dll).

Terus yg ini nemu di milis tapi saya pribadi belum pernah mencoba (copy-n-paste saja ya, he he ) dan tinggal disesuaikan saja setelah dihitung ulang (kira2 angka2 di atas benar nggak ya?) :




Tambahan Dari Forum
Klo itu sudah sejak awal pak
# Options to accelerate Squid
/sbin/sysctl -w vfs.vmiodirenable=1
/sbin/sysctl -w kern.ipc.somaxconn=8192
/sbin/sysctl -w net.inet.tcp.delayed_ack=0
/sbin/sysctl -w net.inet.ip.portrange.last=4000
/sbin/sysctl -w kern.maxfiles=65536
/sbin/sysctl -w net.inet.tcp.sendspace=65535
/sbin/sysctl -w net.inet.tcp.recvspace=65535

# extra
/sbin/sysctl -w kern.ipc.maxsockbuf=2097152
/sbin/sysctl -w kern.ipc.maxsockets=16424
/sbin/sysctl -w kern.maxfilesperproc=32768
/sbin/sysctl -w net.inet.tcp.rfc1323=1
/sbin/sysctl -w net.inet.udp.recvspace=65535
/sbin/sysctl -w net.inet.udp.maxdgram=57344
/sbin/sysctl -w net.local.stream.recvspace=65535
/sbin/sysctl -w net.local.stream.sendspace=65535
/sbin/sysctl -w net.inet.tcp.blackhole=2
/sbin/sysctl -w net.inet.udp.blackhole=1

#streamingan
http://www.bjoern-gaul.de/content/edv-fragen/squid-stream.htm

1 komentar:

Anonymous,  November 2, 2008 at 10:43 PM  

mas, boleh minta tutorial install squid sama tuning kernel nya donk,
Saya buat untuk RT Rw jadi loadnya udah cukup gede.
Kemaren install di FreeBSD 6.2 Squid 2.7 STABLES 4 kalau udah jalan sek 5 jam muncul error

cache# tail -f /var/log/squid/cache.log
2008/11/02 15:05:26| WARNING! Your cache is running out of filedescriptors
2008/11/02 15:05:42| WARNING! Your cache is running out of filedescriptors

kalau di liat dgn netstat -a
0 0 cache.56582 cache.3128 ESTABLISHED
tcp4 0 0 cache.3128 cache.56581 ESTABLISHED
tcp4 0 0 cache.56581 cache.3128 ESTABLISHED
tcp4 0 0 cache.3128 cache.56580 ESTABLISHED
tcp4 0 0 cache.56580 cache.3128 ESTABLISHED
tcp4 0 0 cache.3128 cache.56579 ESTABLISHED ...
banyak sekali kabawah,

kira-kira apnya yang salah yah ..

  © Blogger template The Professional Template by Ourblogtemplates.com 2008

Back to TOP