BolPoint.wordpress.com

July 13, 2011

tcp_miss menjadi tcp_hit squid

Filed under: Linux — bolpoint @ 2:40 am

setelah mendapat pencerahan dari bang opik akhirnya hit juga squid ku

squid 2.6

configurasinya.

http_port 3128 transparent

hierarchy_stoplist cgi-bin ? localhost

acl QUERY urlpath_regex cgi-bin \? localhost

no_cache deny QUERY

acl apache rep_header Server ^Apache

broken_vary_encoding allow apache

cache_mem 8 MB

maximum_object_size_in_memory 32 KB

store_dir_select_algorithm least-load

cache_swap_low 93

cache_swap_high 98

maximum_object_size 128 MB

minimum_object_size 0 KB

ipcache_size 2048

ipcache_low 93

ipcache_high 98

fqdncache_size 2048

cache_replacement_policy heap LFUDA

memory_replacement_policy heap GDSF

cache_dir aufs /home/squid-1 4096 16 256

cache_dir aufs /home/squid-2 4096 16 256

coredump_dir /home/squid-1

access_log /var/log/squid/access.log squid

cache_log /dev/null

cache_store_log none

log_fqdn off

log_icp_queries off

emulate_httpd_log off

log_ip_on_direct on

client_netmask 255.255.255.255

request_header_max_size 20 KB

request_body_max_size 0 KB

refresh_pattern ^ftp: 10080 95% 241920 reload-into-ims override-lastmod

refresh_pattern ^gopher: 1440 0% 1440

refresh_pattern . 180 95% 120960 reload-into-ims override-lastmod

acl webcachehit dstdomain .youtube.com .facebook.com .fbcdn.net .windowsupdate.com .twitter.com

cache allow webcachehit

refresh_pattern ^ftp: 1440 20% 10080

refresh_pattern ^gopher: 1440 0% 1440

refresh_pattern ^http: 720 90% 432000

refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$ 10080 90% 43200 override-expire ignore-no-cache ignore-private

refresh_pattern -i \.(iso|avi|wav|mp3|mp4|mpeg|mpg|swf|flv|x-flv)$ 43200 90% 432000 override-expire ignore-no-cache ignore-private

refresh_pattern -i \.(deb|rpm|exe|ram|bin|pdf|ppt|doc|tiff)$ 10080 90% 43200 override-expire ignore-no-cache ignore-private

refresh_pattern -i \.(zip|gz|arj|lha|lzh|tar|tgz|cab|rar)$ 10080 95% 43200 override-expire ignore-no-cache ignore-private

refresh_pattern -i \.(php|asp|aspx|cgi|html|htm|css|js) 1440 40% 40320

refresh_pattern . 0 20% 4320

refresh_pattern ^http://*.facebook.*/.* 1440 40% 40320

refresh_pattern ^http://*.fbcdn.*/.* 1440 40% 40320

refresh_pattern ^http://*.youtube.*/.* 1440 40% 40320

refresh_pattern ^http://*.c.youtube.*/.* 1440 40% 40320

refresh_pattern ^http://*.twitter.*/.* 1440 40% 40320

refresh_pattern ^http://*.indowebster.*/.* 1440 40% 40320

refresh_pattern ^http://*.yimg.*/.* 1440 40% 40320

refresh_pattern ^http://*.144.channel.facebook.*/.* 1440 40% 40320

refresh_pattern ^http://*.120.channel.facebook.*/.* 1440 40% 40320

refresh_pattern ^http://*.twimg.*/.* 1440 40% 40320

refresh_pattern ^http://*.50cubes.*/.* 1440 40% 40320

quick_abort_min 0

quick_abort_max 0

quick_abort_pct 98

shutdown_lifetime 10 seconds

memory_pools off

icp_hit_stale on

query_icmp on

reload_into_ims on

pipeline_prefetch on

vary_ignore_expire on

acl all src 0.0.0.0/0.0.0.0

acl manager proto cache_object

acl localhost src 127.0.0.1/255.255.255.255

acl to_localhost dst 127.0.0.0/8

acl localnet src 192.168.182.0/255.255.255.0

acl porn url_regex -i “/etc/squid/porn.txt”

acl SSL_ports port 443

acl Safe_ports port 80 # http

acl Safe_ports port 21 # ftp

acl Safe_ports port 443 # https

acl Safe_ports port 70 # gopher

acl Safe_ports port 210 # wais

acl Safe_ports port 1025-65535 # unregistered ports

acl Safe_ports port 280 # http-mgmt

acl Safe_ports port 488 # gss-http

acl Safe_ports port 591 # filemaker

acl Safe_ports port 777 # multiling http

acl CONNECT method CONNECT

acl local-dst dst 192.168.1.0/24 192.168.182.0/24

acl local-domain dstdomain localhost

http_access allow manager localhost

http_access deny porn

http_access deny manager

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access deny to_localhost

http_access allow localnet

http_access allow localhost

http_access deny all

http_reply_access allow all

cache_mgr siji.tux@gmailyahoo.com.sg

visible_hostname bolpoint.wordpress.com

acl siang time M T W H F 12:00-13:30

acl malam time S M T W H F A 18:00-23:59

acl tengahmlm time M T W H F 00:00-02:00

acl lokal src 192.168.182.2-192.168.182.249

acl ekstensiblok url_regex -i \.wmv \.mpg \.mpeg \.wma \.wav \.3gp \.3gpp \.avi \.dat \.aac \.mp4 \.mov \.ogg \.rar \.zip \.7z \.iso \.ace \.exe \.torrent \.mkv \.flv \.rm \.deb \.rpm \.ac3 \.cda \.vro \.dts \.aob \.vob \.mod \.asf \.aif \.au \.mp3

delay_pools 3

delay_class 1 2

delay_parameters 1 25000/2000000 17000/3000000 10000/6000000

delay_access 1 allow ekstensiblok lokal siang !local-domain

delay_access 1 deny ALL

delay_class 2 2

delay_parameters 2 17000/1500000 12000/2000000 7000/5000000

delay_access 2 allow ekstensiblok lokal malam !local-domain

delay_access 2 deny ALL

delay_class 3 2

delay_parameters 3 26000/2000000 18000/3100000 11000/6100000

delay_access 3 allow ekstensiblok lokal tengahmlm !local-domain

delay_access 3 deny ALL

acl speedtest dstdomain .speedtest.cbn.net

acl speedtest dstdomain .speedtest.net

acl speedtest dstdomain .speedtest.

acl speedtest dstdomain .speedtest.telkomspeedy.com

acl speedtest dstdomain speedtest.indosatm2.com

cache allow speedtest

always_direct allow localhost local-dst local-domain

always_direct deny all

url_rewrite_program /usr/bin/python /usr/share/videocache/videocache.py

url_rewrite_children 7

acl videocache_allow_url url_regex -i \/(get_video|videoplayback\?id|videoplayback.*id)

acl videocache_allow_url url_regex -i \.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|wmv|3gp|mp(4|3)|exe|msi|zip|on2|mar)\?

acl videocache_allow_url url_regex -i ^http:\/\/([a-zA-Z-]+[0-9-]+)\.[A-Za-z]*\.[A-Za-z]*

acl videocache_allow_url url_regex -i (([a-z]{1,2}[0-9]{1,3})|([0-9]{1,3}[a-z]{1,2}))\.[a-z]*[0-9]?\.[a-z]{3}

acl videocache_allow_url url_regex -i \.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|avc|zip|mp3|3gp|rar|on2|mar|exe)$

acl videocache_allow_url url_regex -i \.googlevideo\.com\/videoplayback \.googlevideo\.com\/videoplay \.googlevideo\.com\/get_video\?

acl videocache_allow_url url_regex -i \.google\.com\/videoplayback \.google\.com\/videoplay \.google\.com\/get_video\?

acl videocache_allow_url url_regex -i \.google\.[a-z][a-z]\/videoplayback \.google\.[a-z][a-z]\/videoplay \.google\.[a-z][a-z]\/get_video\?

acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplayback\?

acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplay\?

acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/get_video\?

acl videocache_allow_url url_regex -i proxy[a-z0-9\-][a-z0-9][a-z0-9][a-z0-9]?\.dailymotion\.com\/

acl videocache_allow_url url_regex -i vid\.akm\.dailymotion\.com\/

acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv

acl videocache_allow_url url_regex -i bitcast\.vimeo\.com\/vimeo\/videos\/

acl videocache_allow_url url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]?

acl videocache_allow_url url_regex -i \.files\.youporn\.com\/(.*)\/flv\/

acl videocache_allow_url url_regex -i \.msn\.com\.edgesuite\.net\/(.*)\.flv

acl videocache_allow_url url_regex -i media[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ mobile[a-z0-9]?[a-z0-9]?[a-z0-9]?\.ta-z0-9]?[a-z0-9]?\.blip\.tv\/(.*)\.(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram)

acl videocache_allow_url url_regex -i video\.break\.com\/(.*)\.(flv|mp4)

acl videocache_allow_dom dstdomain .4shared.com .indowebster.com .ziddu.com .mccont.com dl.redtube.com .cdn.dailymotion.com speedtest.net speedtest.telkomspeedy.com speedtest.indosatm2.com

acl videocache_deny_url url_regex -i http:\/\/[a-z][a-z]\.youtube\.com http:\/\/www\.youtube\.com

url_rewrite_access allow videocache_deny_url

url_rewrite_access allow videocache_allow_url

url_rewrite_access allow videocache_allow_dom

redirector_bypass on

refresh_pattern (get_video\?|videoplayback\?|videodownload\?|\.flv?) 43200 999999% 43200

refresh_pattern (get_video\?|videoplayback\?id|videoplayback.*id|videodownload\?|\.flv?) 43200 999999% 43200

dan ini hitnya

Thanks buat bang opik punya ku udah bisa, akhirnya aku bisa senyum… karena sekian lama nunggu

Code:

1310516750.213     83 192.168.182.3 TCP_HIT/200 7561 GET http://photos-c.ak.fbcdn.net/hphotos-ak-ash4/262224_126582894095464_100002312618997_206542_1461770_s.jpg - NONE/- image/jpeg
1310516750.245     31 192.168.182.3 TCP_HIT/200 7066 GET http://photos-c.ak.fbcdn.net/hphotos-ak-snc6/261976_126350357452051_100002312618997_205611_1888400_s.jpg - NONE/- image/jpeg
1310516750.325     78 192.168.182.3 TCP_HIT/200 7723 GET http://photos-f.ak.fbcdn.net/hphotos-ak-snc6/283593_126570254096728_100002312618997_206423_1985054_s.jpg - NONE/- image/jpeg
1310516750.326     81 192.168.182.3 TCP_HIT/200 7347 GET http://photos-b.ak.fbcdn.net/hphotos-ak-snc6/270479_126276634126090_100002312618997_205476_2619628_s.jpg - NONE/- image/jpeg
1310516750.327     70 192.168.182.3 TCP_HIT/200 7364 GET http://photos-f.ak.fbcdn.net/hphotos-ak-ash4/268339_126564407430646_100002312618997_206414_8154638_s.jpg - NONE/- image/jpeg
1310516750.350     81 192.168.182.3 TCP_HIT/200 6276 GET http://photos-d.ak.fbcdn.net/hphotos-ak-ash4/268295_126564774097276_100002312618997_206415_8350175_s.jpg - NONE/- image/jpeg
1310516750.350     79 192.168.182.3 TCP_HIT/200 6379 GET http://photos-d.ak.fbcdn.net/hphotos-ak-ash4/263921_126284134125340_100002312618997_205494_6301620_s.jpg - NONE/- image/jpeg
1310516750.374     72 192.168.182.3 TCP_HIT/200 6784 GET http://photos-g.ak.fbcdn.net/hphotos-ak-snc6/261915_126563844097369_100002312618997_206413_4415077_s.jpg - NONE/- image/jpeg
1310516750.385     43 192.168.182.3 TCP_HIT/200 6265 GET http://photos-g.ak.fbcdn.net/hphotos-ak-ash4/263772_126351314118622_100002312618997_205624_18975_s.jpg - NONE/- image/jpeg

8 Comments »

  1. Mas kalo untuk squid versi 2.7 build 9 apa saja yang perlu di rubah, atau mas punya yang untuk versi tersebut ? Aku pake yg versi wind$, selama ini pake yg dari ccpb.

    Comment by elhadiry — July 3, 2012 @ 1:59 pm | Reply

  2. refresh_pattern ^http://*.twitter.*/.* 1440 40% 40320

    beneran nih rule.a, setahu sya buat twitter itu https
    emang bisa ng cache ….?????

    Comment by Rifq Adabi — October 6, 2012 @ 8:17 am | Reply

    • yang di cache biasanya untuk link2 http saja, misal gambar, css dsb..

      Comment by bolpoint — November 12, 2012 @ 8:47 am | Reply

  3. Mas bagian konfigurasi yang menjadikan tcp_hit yang mana ya?

    Comment by Ari' — November 27, 2012 @ 9:00 am | Reply

  4. tail ……………… |grep HIT

    Comment by dodol — December 1, 2012 @ 4:24 am | Reply

  5. kalau squidnya pake mikrotik gimana gan…
    saya menggunakan squid external proxy clearos

    Comment by meli suwantono — May 4, 2013 @ 9:45 am | Reply

  6. mas maaf mau tanya untuk program video_cache.py nya kyak gmna mas. saya kurang paham mas…saya baru belajar tentang cache. mhon bntuannya. makasih mas

    Comment by ahmatchoeri — June 2, 2014 @ 3:46 am | Reply

  7. Numpang tanya gan, squid.conf-nya bisa di-aplikasikan untuk squid windows 2.7 gak?
    Selain setting folder cache & log, apa lagi yg perlu dirubah?

    Thx b4

    Comment by Aldi — July 18, 2014 @ 10:33 pm | Reply


RSS feed for comments on this post. TrackBack URI

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

Create a free website or blog at WordPress.com.

%d bloggers like this: