Cache in Squid Server
Assalam o Alaikum!
I am facing problem in squid caching. In squid.conf: cache_dir ufs /var/spool/squid 100 16 256 [root@test1 /]# squid -z 2012/06/01 07:23:05| WARNING cache_mem is larger than total disk cache space! Or [root@test1 /]# service squid restart Stopping squid: 2012/06/01 07:23:39| WARNING cache_mem is larger than total disk cache space! ................ [ OK ] Starting squid: . [ OK ] [root@test1 /]# cat /proc/meminfo MemTotal: 767248 kB MemFree: 27172 kB Buffers: 99604 kB Cached: 343260 kB SwapCached: 8 kB Active: 322416 kB Inactive: 342244 kB Active(anon): 103316 kB Inactive(anon): 122236 kB Active(file): 219100 kB Inactive(file): 220008 kB Unevictable: 0 kB Mlocked: 0 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 767248 kB LowFree: 27172 kB SwapTotal: 1507324 kB SwapFree: 1507316 kB Dirty: 1008 kB Writeback: 0 kB AnonPages: 221788 kB Mapped: 73324 kB Shmem: 3756 kB Slab: 61592 kB SReclaimable: 52992 kB SUnreclaim: 8600 kB KernelStack: 1760 kB PageTables: 5688 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 1890948 kB Committed_AS: 1067352 kB VmallocTotal: 237624 kB VmallocUsed: 5916 kB VmallocChunk: 223032 kB HardwareCorrupted: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 4096 kB DirectMap4k: 16320 kB DirectMap4M: 770048 kB Wht shud I do? Many thanks! |
Hi,
It looks like you have defined a cache_mem bigger than the cache_dir (that is 100MB in your case). You can either ignore it (it's just a warning), or set cache_mem lower than 100MB Regards |
Thanks for your reply. where i can find cache_mem? I mean how can I change this parameter? I have one more question how can I verify cache webs? I mean whether it is taking web from my cache or from internet?
[root@Zohaib zohaib_shaikh]# tail -f /var/log/squid/access.log 1338567636.688 763 192.168.1.111 TCP_MISS/200 1138 GET http://us.mg5.mail.yahoo.com/ws/mail/v2.0/formrpc? - DIRECT/183.177.93.20 application/json 1338567656.143 28770 192.168.1.111 TCP_MISS/200 399 GET http://prod1.rest-notify.msg.yahoo.c...annel/uk.engr? - DIRECT/67.195.186.237 application/json 1338567677.176 312770 192.168.1.111 TCP_MISS/200 1535 CONNECT mail.google.com:443 - DIRECT/74.125.232.117 - Its look like it is taking webs from internet not from cache?? |
Hi,
Quote:
Quote:
When you see a TCP_MISS it means that the object was not cached. A TCP_HIT means that the object was fetched from cache. For a better explanation see this Regards |
1 Attachment(s)
Thanks. I am unable to find cache_mem option in squid.conf. I have attached my squid.conf in txt format. Kindly see this. How can I trouble shoot the problem of TCP_MISS? When I repeatedly open same webs it gives same message of TCP_MISS.
|
Quote:
Code:
cache_mem 32 MB Quote:
Code:
squid -z Note that this is done only once, before squid starts for the 1st time. Maybe you don't have a correct cache_dir and that's the reason for squid complaining about cache_mem. |
Thanks. Dear, I tried cache_mem 32 MB, it works, now warning does not appears. This problem is resolved.
Now I am unable to resolve TCP_MISS problem. I have also used squid -z its output is: [root@Zohaib zohaib_shaikh]# service squid stop Stopping squid: ................ [ OK ] [root@Zohaib zohaib_shaikh]# squid -z 2012/06/05 18:32:52| Creating Swap Directories 2012/06/05 18:32:52| /var/spool/squid exists 2012/06/05 18:32:52| /var/spool/squid/00 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/00 2012/06/05 18:32:52| /var/spool/squid/01 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/01 2012/06/05 18:32:52| /var/spool/squid/02 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/02 2012/06/05 18:32:52| /var/spool/squid/03 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/03 2012/06/05 18:32:52| /var/spool/squid/04 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/04 2012/06/05 18:32:52| /var/spool/squid/05 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/05 2012/06/05 18:32:52| /var/spool/squid/06 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/06 2012/06/05 18:32:52| /var/spool/squid/07 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/07 2012/06/05 18:32:52| /var/spool/squid/08 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/08 2012/06/05 18:32:52| /var/spool/squid/09 exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/09 2012/06/05 18:32:52| /var/spool/squid/0A exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/0A 2012/06/05 18:32:52| /var/spool/squid/0B exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/0B 2012/06/05 18:32:52| /var/spool/squid/0C exists 2012/06/05 18:32:52| Making directories in /var/spool/squid/0C After restarting squid's service and accessing webs we have following log: [root@Zohaib zohaib_shaikh]# tail -f /var/log/squid/access.log 1338901168.271 1864 192.168.1.109 TCP_MISS/200 1137 GET http://us.mg5.mail.yahoo.com/ws/mail/v2.0/formrpc? - DIRECT/183.177.93.20 application/json 1338901178.432 274105 192.168.1.109 TCP_MISS/200 2570 CONNECT mail.google.com:443 - DIRECT/173.194.35.117 - 1338901285.974 120000 192.168.1.109 TCP_MISS/000 0 GET http://prod2.rest-notify.msg.yahoo.c...annel/uk.engr? - DIRECT/216.155.195.253 - 1338901318.098 310000 192.168.1.109 TCP_MISS/200 2026 CONNECT mail.google.com:443 - DIRECT/173.194.35.117 - Means no cacheing? How can we fix this problem? |
Hi,
If you want to test squid caching, you should visit the same URL several times and from the same or different systems/browsers and see what you get. The 1st time you'll get a TCP_MISS, but after that you should start getting get TCP_HITs Regards |
Quote:
Yes I tried the same but every time I got TCP_MISS so please any solution? |
Quote:
|
Now I get following logs
First time: 1340100083.871 499 192.168.1.117 TCP_MISS/200 1870 GET http://www.squid-cache.org/favicon.ico - DIRECT/198.186.193.234 image/x-icon ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2nd and 3rd time 1340100099.589 1054 192.168.1.117 TCP_REFRESH_UNMODIFIED/304 531 GET http://www.squid-cache.org/ - DIRECT/198.186.193.234 - Still not cacheing. |
The above 2 lines mean nothing. You should hit the site and watch squid access.log for the whole time. There should be many objects (like images etc) logged.
Then use another browser, hit the same site again and watch what happens with these objects. See for example the following snippets for another site: Quote:
|
Yes dear, i understand now. It cacheing only static things. I got TCP_HIT. thanks dear.
|
All times are GMT -5. The time now is 07:31 AM. |