Old data can't be entered into memory cache after squid restart

121 5

A problem encountered in actual use. I'm going to get a -k shutdown.
-s. Restart.

Then read squid 's access log, found that the files that were originally cached are just tcp hits, and any frequent access can't be loaded into the tcp mem hit.
If it was originally no cached file, new access asks, the first miss, the second is tcp mem hit memory hit.

The replacement strategy uses the default lru, which isn't clear what the internal mechanism is exchanged between the memory and disk.

1 Answers

120 5

All right, it looks like you find the answer.

This is due to how the cache_mem cache works. It only stores objects cache.

See this: http://www. Squid-cache. Org/mail-archi..

So squid will only add data from the backend to the memory, and if the data is loaded from disk, it'll not be placed on disk. But the data will never be on disk. When you set the cache time expires, this data will restart from the backend. There's a chance to join in memory. So even if your data is static, it's better to return an expired header at http. Otherwise, the memory cache isn't. And there's no chance to load into memory cache. Can only take advantage of the file system cache layer.

93 4

All right, it looks like you find the answer.

This is due to how the cache_mem cache works. It only stores objects cache.

See this: http://www. Squid-cache. Org/mail-archi..

So squid will only add data from the backend to the memory, and if the data is loaded from disk, it'll not be placed on disk. But the data will never be on disk. When you set the cache time expires, this data will restart from the backend. There's a chance to join in memory. So even if your data is static, it's better to return an expired header at http. Otherwise, the memory cache isn't. And there's no chance to load into memory cache. Can only take advantage of the file system cache layer.

...