Twice as much memory used as accounted for

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Twice as much memory used as accounted for

rihad
Hi! Our Squid hits the OS imposed memory limit of 1500 MB (data segment
only) and dies after less than a day of work. Rather than performing the
usual steps such as lowering cache_mem or increasing the memory limit, I
  wanted to try to find out why Squid's using that much. Here come some
parts of "Memory Utilization" page in cachemgr.cgi taken 1 minute before
Squid died with the error:

FATAL: xcalloc: Unable to allocate 1 blocks of 4108 bytes!

     Pool        Obj Size        Allocated
                 (bytes) (#)     (KB)    high (KB)
MemObject       148     5312    768     768
mem_node        4108    9210    36948   36948
StoreEntry      48      4143221 194214  194214
MD5 digest      16      4143221 64738   64738
Total           -       8420732 308233  308233

Cumulative allocated volume: 2.68 GB
Current overhead: 46571 bytes (0.015%)
Idle pool limit: 300.00 MB
memPoolAlloc calls: 23471003
memPoolFree calls: 15052272

Idle pool usage was very low at the moment: 2373 KB

relevant squid.conf parts changed from defaults:

cache_mem 500 MB
maximum_object_size 8 MB
maximum_object_size_in_memory 12 KB
cache_replacement_policy heap GDSF
memory_replacement_policy heap GDSF
cache_dir aufs /cache 50000 128 256
memory_pools_limit 300 MB


Where did the difference between Squid's actual usage (1504MB one minute
before the crash) and the accounted 8420732 KB go?

Using Squid 2.6.STABLE13 on FreeBSD 6.2. Please let me know if you need
more information.

Thank you in advance for any insights.
Reply | Threaded
Open this post in threaded view
|

Re: Twice as much memory used as accounted for

Henrik Nordström
sön 2007-06-10 klockan 11:40 +0500 skrev rihad:

> Where did the difference between Squid's actual usage (1504MB one minute
> before the crash) and the accounted 8420732 KB go?

Not all memory is accounted. But your difference seems a little high.

You can find quite a bit of information about how Squid uses memory in
the FAQ. http://wiki.squid-cache.org/SquidFaq/SquidMemory with the most
important being "How much memory do I need in my Squid server?"
http://wiki.squid-cache.org/SquidFaq/SquidMemory#head-09818ad4cb8a1dfea1f51688c41bdf4b79a69991

Regards
Henrik

signature.asc (316 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Twice as much memory used as accounted for

rihad
Henrik Nordstrom wrote:
> sön 2007-06-10 klockan 11:40 +0500 skrev rihad:
>
>> Where did the difference between Squid's actual usage (1504MB one minute
>> before the crash) and the accounted 8420732 KB go?
>
> Not all memory is accounted. But your difference seems a little high.
>
Hey, Henrik, thanks for the heads up. I have a strong suspicion that
this config line is responsible for our much increased memory use:

cache_replacement_policy heap GDSF

Previously we used the heap LFUDA policy instead, at which time 1150 MB
process size limit was enough to handle a 50 GB cache_dir + 256 MB
cache_mem. But now 1500 MB process size is not enough to handle exactly
500 MB cache_mem with heap GDSF. Af first sight a 350MB increase in
process size would be plenty to cover the 244MB increase of cache_mem.
But if you take our 4,5 million cached objects with GDSF into account
(as opposed to a little over 3 million with LFUDA) one can see why Squid
now requires more memory than expected. Am I right in this reasoning?
Reply | Threaded
Open this post in threaded view
|

Re: Twice as much memory used as accounted for

Henrik Nordström
mån 2007-06-11 klockan 00:34 +0500 skrev rihad:

> Previously we used the heap LFUDA policy instead, at which time 1150 MB
> process size limit was enough to handle a 50 GB cache_dir + 256 MB
> cache_mem. But now 1500 MB process size is not enough to handle exactly
> 500 MB cache_mem with heap GDSF. Af first sight a 350MB increase in
> process size would be plenty to cover the 244MB increase of cache_mem.
> But if you take our 4,5 million cached objects with GDSF into account
> (as opposed to a little over 3 million with LFUDA) one can see why Squid
> now requires more memory than expected. Am I right in this reasoning?


Yes, more cached objects means higher memory usage. Quite linearly so if
you deduct the cache_mem.

Regards
Henrik

signature.asc (316 bytes) Download Attachment