<div dir="ltr"><div>Hello!</div><div><br></div><div>After migrating squid from non-SMP/aufs to SMP/rock memory cache hit ratio dropped significantly. Like from 50-100% to 1-5%. And disk cache hit ratio went up from 15-50% to stable 60-65%. From the brief log file check it looks like in SMP/rock mode squid avoids using memory for small files like 1-3KB but uses it for 10KB+ files.</div><div><br></div><div>I started tracking down the issue with disabling disk cache completely and it didn't change anything, I just started to get MISS every time for the URL which was getting MEM_HIT with an old configuration. Then I changed "workers 2" to "workers 1" and started getting memory hits as before.</div><div><br></div><div>So it seems like the issue is with shared memory:</div><div><br></div><div>When squid doesn't use shared memory it works as expected. Even with multiple workers.</div><div>When squid uses shared memory it caches very small amount of objects.</div><div><br></div><div>Am I doing anything wrong? Which debug options should I enable to provide more information if it seems like a bug?</div><div><br></div><div>Config diff:</div><div><br></div><div>--- squid.conf.old  2018-01-14 02:01:19.000000000 -0800</div><div>+++ squid.conf.new  2018-01-14 02:01:16.000000000 -0800</div><div>@@ -1,5 +1,8 @@</div><div> http_port <a href="http://0.0.0.0:3128">0.0.0.0:3128</a></div><div> </div><div>+workers 2</div><div>+cpu_affinity_map process_numbers=1,2 cores=1,2</div><div>+</div><div> acl localnet src <a href="http://10.0.0.0/8">10.0.0.0/8</a>     # RFC1918 possible internal network</div><div> acl localnet src <a href="http://172.16.0.0/12">172.16.0.0/12</a>  # RFC1918 possible internal network</div><div> acl localnet src <a href="http://192.168.0.0/16">192.168.0.0/16</a> # RFC1918 possible internal network</div><div>@@ -94,13 +97,12 @@</div><div> </div><div> never_direct allow all</div><div> </div><div>-cache_mem 9420328 KB</div><div>-maximum_object_size_in_memory 32 KB</div><div>+cache_mem 12560438 KB</div><div>+maximum_object_size_in_memory 64 KB</div><div> memory_replacement_policy heap LRU</div><div> cache_replacement_policy heap LRU</div><div> </div><div>-cache_dir aufs /mnt/services/squid/cache/cache0 261120 16 256</div><div>-cache_dir aufs /mnt/services/squid/cache/cache1 261120 16 256</div><div>+cache_dir rock /mnt/services/squid/cache 522240 swap-timeout=500 max-swap-rate=1200 slot-size=16384</div><div> </div><div> minimum_object_size 64 bytes # none-zero so we dont cache mistakes</div><div> maximum_object_size 102400 KB</div><div><br></div><div><br></div><div>All relevant config options together (SMP/rock):</div><div><br></div><div>workers 2</div><div>cpu_affinity_map process_numbers=1,2 cores=1,2</div><div><br></div><div>cache_mem 12560438 KB</div><div>maximum_object_size_in_memory 64 KB</div><div>memory_replacement_policy heap LRU</div><div>cache_replacement_policy heap LRU</div><div><br></div><div>cache_dir rock /mnt/services/squid/cache 522240 swap-timeout=500 max-swap-rate=1200 slot-size=16384</div><div><br></div><div>minimum_object_size 64 bytes # none-zero so we dont cache mistakes</div><div>maximum_object_size 102400 KB</div><div><br></div><div>negative_ttl 0 seconds</div><div>range_offset_limit none</div><div><br></div><div><br></div><div>Squid version:</div><div><br></div><div>Squid Cache: Version 3.5.27</div><div>Service Name: squid</div><div>configure options:  '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/sbin' '--sbindir=/usr/sbin' '--sysconfdir=/etc/squid' '--libdir=/usr/lib' '--libexecdir=/usr/lib/squid' '--includedir=/usr/include' '--datadir=/usr/share' '--sharedstatedir=/usr/com' '--localstatedir=/var' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-epoll' '--enable-removal-policies=heap,lru' '--enable-storeio=aufs,rock' '--enable-delay-pools' '--with-pthreads' '--enable-cache-digests' '--with-large-files' '--with-maxfd=16384' '--enable-htcp'</div><div><br></div>-- <br><div class="gmail_signature">With best regards, Ivan Larionov.</div>
</div>