Optimalkan SQUID 2.6 STABLE untuk hit ratios 40% (atau lebih)

HOooah… Lama ane ndak nulis karena lagi sibuk caru sesuap nasi n belajar sana sini (BIlang AJa LEk Maleezzz.. WKwkkkkk.. :p). Oh ya ni saya mau share tenatng konfigurasi SQUID 2.6 agar cache hit rationya bisa 40% bahkan lebih. Wuihh.. namun ada juga yang hitnya bisa sampe 70% di forum.linux.or.id.

okey langsung saja. disini saya memakai mesin dengan OS CLEAR OS 5.2 Enterprise dengan setting gateway.  BTW kita juga butuh winscp atau pake putty tuk remote mesin kita. Langsung saja cekidot…

  • login sebagai root di putty atau winscp, kemudian masuka ke /etc/squid. buka pake vim (bila pake putty) file squid.conf
  • cari maximum_object_size_in_memory (pake find aja dech biar cepet) ganti dengan dibawah

maximum_object_size_in_memory 64 KB (apabila RAM lebih dari 512 bisa dilebihkan)

  • Ganti cache_replacement_policy  dan memory_replacement_policy yang semula lru ke

cache_replacement_policy heap LFUDA
memory_replacement_policy heap GDSF

  • kemudian ini dalah bain yang terpenting yaitu REFRESH_PATTERN sisipi text dibawah ini

refresh_pattern -i ^http://*.windowsupdate.com/.* 1440 99% 518400 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(tiff|mov|avi|qt|mpeg|flv|ra|rm|wmv|divx)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(class|css|js|gif|jpg|ps)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(jpe|jpeg|png|bmp|tif)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(mpg|mpe|wav|au|mid|mp3|mp4|ac4|swf)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(zip|gz|arj|lha|lzh|7z)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(rar|tgz|tar|exe|bin|rpm|iso)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(hqx|pdf|rtf|doc|swf|xls|ppt|pdf|docx|xlsx)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i \.(inc|cab|ad|txt|dll|dat)$ 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i ^http://*.zynga.com/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i ^http://*.friendster.com/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i ^http://*.kompas.com/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i ^http://*.detik.com/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i ^http://*.facebook.com/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims
refresh_pattern -i ^http://*.bhinneka.com/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims ignore-reload
refresh_pattern -i ^http://*.fbcdn.net/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims
refresh_pattern -i ^http://*.yahoo.*/.* 1440 90% 432000 override-expire override-lastmod reload-into-ims
refresh_pattern . 0 50% 4320 reload-into-ims override-lastmod

  • tambahkan beberapa opsi web atau refresh pattern yang lain, namun jangan terlalu over. alih2 inginkan hit max maun malah akses menjadi pelan. Tambahakn secukupnya saja
  • Tambahkan delay_pool untuk membatasi download client

acl file url_regex -i \.(tiff|mov|avi|3gp|mpeg|flv|ra|rm|wmv|divx|mpg|mpe)
acl file url_regex -i \.(mp3|ogg|mp2|wav|mid)
acl file url_regex -i \.(rar|zip|gz|iso)
acl file url_regex -i \.(doc|xls|pdf)

delay_pools 1

delay_class 1 3

delay_parameters 1 64000/64000 4000/64000 250/250

delay_access 1 allow file
delay_access 1 deny all

  • Tips lain: alangkah baiknya kalo cache directory kita berupa partis bukan folder, sehingga prosesnya kan lebih maksimal
  • simpan squid.conf anda kemudian jalankan

squid -k reconfigure

  • klo tdk muncul pesan error. restart service squid anda
  • cek hit setelah beberapa menit dengan squidclient -p 3128 mgr:info
  • lihat presentase rasionya. apabila kurang greget boleh di oprek sendiri

selamat mencoba….

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: