Hello!
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.
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.
So it seems like the issue is with shared memory:
When squid doesn't use shared memory it works as expected. Even with multiple workers.
When squid uses shared memory it caches very small amount of objects.
Am I doing anything wrong? Which debug options should I enable to provide more information if it seems like a bug?
Config diff:
--- squid.conf.old 2018-01-14 02:01:19.000000000 -0800
+++ squid.conf.new 2018-01-14 02:01:16.000000000 -0800
@@ -1,5 +1,8 @@
http_port 0.0.0.0:3128
+workers 2
+cpu_affinity_map process_numbers=1,2 cores=1,2
+
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
@@ -94,13 +97,12 @@
never_direct allow all
-cache_mem 9420328 KB
-maximum_object_size_in_memory 32 KB
+cache_mem 12560438 KB
+maximum_object_size_in_memory 64 KB
memory_replacement_policy heap LRU
cache_replacement_policy heap LRU
-cache_dir aufs /mnt/services/squid/cache/cache0 261120 16 256
-cache_dir aufs /mnt/services/squid/cache/cache1 261120 16 256
+cache_dir rock /mnt/services/squid/cache 522240 swap-timeout=500 max-swap-rate=1200 slot-size=16384
minimum_object_size 64 bytes # none-zero so we dont cache mistakes
maximum_object_size 102400 KB
All relevant config options together (SMP/rock):
workers 2
cpu_affinity_map process_numbers=1,2 cores=1,2
cache_mem 12560438 KB
maximum_object_size_in_memory 64 KB
memory_replacement_policy heap LRU
cache_replacement_policy heap LRU
cache_dir rock /mnt/services/squid/cache 522240 swap-timeout=500 max-swap-rate=1200 slot-size=16384
minimum_object_size 64 bytes # none-zero so we dont cache mistakes
maximum_object_size 102400 KB
negative_ttl 0 seconds
range_offset_limit none
Squid version:
Squid Cache: Version 3.5.27
Service Name: squid
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'
With best regards, Ivan Larionov.
_______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users