Re: [squid-users] No memory left, buffers eats all ram. Is any solution?

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Sun, 06 Apr 2008 16:36:51 +0200

sön 2008-04-06 klockan 12:34 +0200 skrev Tomasz:
> Hello,
>
> I have sever with 8GB memory
> ps aux shows that squid is using max 3467800.

Ok.

> cachemgr.cgi shows:
> Memory usage for squid via mallinfo():
[mallinfo breaks down above 2GB]
> Memory accounted for:
> Total accounted: 3032558 KB

Ok.

> w3cache ~ # cat /etc/squid/squid.conf | grep cache_dir | grep -v "^#"
> cache_dir aufs /var/cache/squid/dysk1 30000 16 256
> cache_dir aufs /var/cache/squid/dysk2 30000 16 256
> cache_dir coss /dev/sdd1 30000 block-size=2048 overwrite-percent=40
> max-size=1048576 membufs=30
> cache_dir coss /dev/sde1 30000 block-size=2048 overwrite-percent=40
> max-size=1048576 membufs=30
> (In cache.log i seen that standard 10mb membfus was too small)

4 * 30 * 10 MB = 1.2 GB
>
> Is in that configuration 4-5GB of ram may be used for cache etc?
> Is it normal?
>
> I have also huge amount of ram used for cache_mem:
> w3cache ~ # cat /etc/squid/squid.conf | grep cache_mem | grep -v "^#"
> cache_mem 2048 MB

1.2 GB + 2 GB = 3.2 GB.

> Problem is that squid is using max 4gb of ram, and other ~4gb are used for
> buffers etc..,and then there is no memory left - swap grows up, so squid
> response time grows up too :/

Disable the swap. You don't need it and it's only causing you problems.

> Why there is so much buffers?

Linux uses any free memory as filesystem cache to speed up disk access.
But the problem is that if you have an huge application with lots of
infrequently accessed memory such as Squid this may cause the
application to get partially swapped out even when there isn't really a
shortage of memory.. and for Squid it's very bad to get swapped out..
(unlike most other applications in that memory usage category)

> w3cache ~ # free
> total used free shared buffers cached
> Mem: 8155824 8108788 47036 0 2687584 1048768
> -/+ buffers/cache: 4372436 3783388
> Swap: 996008 167864 828144

Plenty of free memory there.

Regards
Henrik
Received on Sun Apr 06 2008 - 08:38:17 MDT

This archive was generated by hypermail 2.2.0 : Thu May 01 2008 - 12:00:04 MDT