<div dir="ltr">Hello.<div><br></div><div>I'm pretty sure this question has been asked multiple times already, but after reading everything I found I still can't figure out squid memory usage patterns.</div><div><br></div><div>We're currently trying to upgrade from squid 2.7 to squid 3.5 and memory usage on squid 3 is much much higher compared to squid 2 with the same configuration.</div><div><br></div><div>What do I see:</div><div><br></div><div>squid running for several days with low traffic:</div><div><br></div><div><div># top</div><div> PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND</div><div> 7367 squid     20   0 4780m 4.4g 5224 S  6.0 60.6 105:01.76 squid -N</div><div><br></div><div>So it uses 4.4GB resident memory. Ok, let's see important config options:</div><div><br></div><div>cache_mem 2298756 KB<br></div><div><div>maximum_object_size_in_memory 8 KB</div><div>memory_replacement_policy lru</div><div>cache_replacement_policy lru</div></div><div><br></div><div><div>cache_dir aufs /mnt/services/squid/cache 445644 16 256</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><div><br></div><div>So we configured 2.2GB memory cache and 500GB disk cache. Disk cache is quite big but current usage is only 3GB:</div><div><br></div><div><div># du -sh /mnt/services/squid/cache # cache_dir</div><div>3.0G  /mnt/services/squid/cache</div></div><div><br></div><div>Now I'm looking into this page <a href="http://wiki.squid-cache.org/SquidFaq/SquidMemory">http://wiki.squid-cache.org/SquidFaq/SquidMemory</a> and see:</div><div><br></div><div>14 MB of memory per 1 GB on disk for 64-bit Squid<br></div><div><br></div><div>Which means disk cache should use ~50MB of RAM.</div><div><br></div><div>All these means we have ~2.2GB ram used for everything else except cache_mem and disk cache index.</div><div><br></div><div>Let's see top pools from mgr:mem:</div><div><br></div><div><div>Pool                  (KB)     %Tot</div><div>mem_node              2298833  55.082</div><div>Short Strings         622365   14.913</div><div>HttpHeaderEntry       404531   9.693</div><div>Long Strings          284520   6.817</div><div>MemObject             182288   4.368</div><div>HttpReply             155612   3.729</div><div>StoreEntry            73965    1.772</div><div>Medium Strings        71152    1.705</div><div>cbdata MemBuf (12)    35573    0.852</div><div>LRU policy node       30403    0.728</div><div>MD5 digest            11380    0.273</div><div>16K Buffer            1056     0.025</div></div><div><br></div><div><div>These pools consume ~35% of total squid memory usage: Short Strings, HttpHeaderEntry, Long Strings, HttpReply. Looks suspicious. On squid 2 same pools use 10 times less memory.</div></div><div><br></div><div>I found a bug which looks similar to our experience: <a href="http://bugs.squid-cache.org/show_bug.cgi?id=4084">http://bugs.squid-cache.org/show_bug.cgi?id=4084</a>.</div><div><br></div><div>I'm attaching our config, mgr:info, mgr:mem and some system info I collected.</div><div><br></div><div>Could someone say if this is normal and why it's so much different from squid 2?</div><div><br></div>-- <br><div class="gmail_signature">With best regards, Ivan Larionov.</div>
</div></div>