Why does Squid very rarely get TCP_HIT in the log, which consists mostly of TCP_MISS?

Contango asked:

I am using Squid v2.7.

I am getting lots of TCP_MISS messages in the log, and very few TCP_HIT.

What does this mean?

p.s. Here is a sample of the log:

1369840631.853     59 127.0.0.1 TCP_MISS/200 49714 GET http://pagead2.googlesyndication.com/pagead/imgad? - DIRECT/173.194.41.77 application/x-shockwave-flash
1369840631.883    141 127.0.0.1 TCP_MISS/302 1254 GET http://altfarm.mediaplex.com/ad/js/18329-129461-2056-10? - DIRECT/89.207.18.182 -
1369840631.964    163 127.0.0.1 TCP_MISS/200 7939 CONNECT urs.microsoft.com:443 - DIRECT/157.55.231.253 -
1369840631.971    160 127.0.0.1 TCP_MISS/200 7971 CONNECT urs.microsoft.com:443 - DIRECT/157.55.231.253 -
1369840632.093    205 127.0.0.1 TCP_MISS/200 8803 GET http://img.mediaplex.com/content/0/18329/1510_FREE_CrystalClear_Fruitmachine_DCF_300x250_1cc304.js? - DIRECT/89.207.18.181 text/javascript
1369840632.317    193 127.0.0.1 TCP_MISS/200 56608 GET http://img-cdn.mediaplex.com/0/18329/1510_FREE_CrystalClear_Fruitmachine_DCF_300x250_1cc304.swf - DIRECT/46.33.70.42 application/x-shockwave-flash
1369840813.425 287250 127.0.0.1 TCP_MISS/200 12260 CONNECT plus.google.com:443 - DIRECT/173.194.34.70 -
1369840824.390 293221 127.0.0.1 TCP_MISS/200 5204 CONNECT csi.gstatic.com:443 - DIRECT/74.125.226.111 -
1369837426.298      0 127.0.0.1 TCP_MEM_HIT/200 2565 GET http://0.gravatar.com/avatar/0d5183de3952f6c8645c5e6140938ef7? - NONE/- image/png
1369837426.299      1 127.0.0.1 TCP_MEM_HIT/200 1917 GET http://0.gravatar.com/avatar/cbbed29064ada5c3686c4d980e545e67? - NONE/- image/jpeg
1369837426.299      0 127.0.0.1 TCP_MEM_HIT/200 2190 GET http://1.gravatar.com/avatar/9986282128def4361d1971b8bbe3d0d2? - NONE/- image/png

My answer:


All of the requests you’ve shown that missed the cache fall into two categories:

  1. HTTPS requests, which squid simply passes on to the remote site.
  2. Requests for ads, where it seems that the URLs are customized for each user.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.