Re: [squid-users] Continuously growing SWAP

From: Marc Elsen <marc.elsen@dont-contact.us>
Date: Mon, 20 Jan 2003 17:42:16 +0100

Ron Vachiyer wrote:
>
> Hello,
>
> I am running Squid 2.5STABLE1 on a P4-1800 with 2GB of RAM and 2 18Gig HDs,
> reiserfs. I have been for the longest time battling a problem of a
> constantly growing swap space. I have been told to increase RAM, use PS to
> see squid memory usage, and within a week I exhaust all swap space and need
> to stop the squid process and re-start squid to free the paged memory. I am
> running Linux 2.4.20, however I had the same problem with Linux 2.2.20 when
> I was running Squid on an older machine.
>
> Here is the output of PS:
>
> root 700 0.0 0.0 6544 648 ? S Jan16 0:00
> /usr/local/squid/
> nobody 702 45.6 38.8 886292 805280 ? R Jan16 2556:24 (squid)
> nobody 703 0.0 0.0 1348 264 ? S Jan16 0:00 (unlinkd)
> nobody 705 0.0 38.8 886292 805280 ? S Jan16 0:00 (squid)
> nobody 706 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 707 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 708 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 709 0.0 38.8 886292 805280 ? S Jan16 1:16 (squid)
> nobody 710 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 711 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 712 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 713 0.0 38.8 886292 805280 ? S Jan16 1:16 (squid)
> nobody 714 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 715 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 716 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 717 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 718 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 719 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 720 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 721 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 722 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 723 0.0 38.8 886292 805280 ? S Jan16 1:16 (squid)
> nobody 724 0.0 38.8 886292 805280 ? S Jan16 1:16 (squid)
> nobody 725 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 726 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 727 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 728 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 729 0.0 38.8 886292 805280 ? S Jan16 1:13 (squid)
> nobody 730 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 731 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 732 0.0 38.8 886292 805280 ? S Jan16 1:16 (squid)
> nobody 733 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 734 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 735 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
> nobody 736 0.0 38.8 886292 805280 ? S Jan16 1:14 (squid)
> nobody 737 0.0 38.8 886292 805280 ? S Jan16 1:15 (squid)
>
> Notice squid seems to be using 886M of RAM, however "free" reports:
>
> free
> total used free shared buffers cached
> Mem: 2070368 2062064 8304 0 304564 712196
> -/+ buffers/cache: 1045304 1025064
> Swap: 104412 41700 62712
>
> There is 42Mb of swap in 3 days of runtime.
>
> Cache mem is set to 256Mb. Here is the relavent CacheMgr output:
>
> Memory usage for squid via mstats():
> Total space in arena: 816748 KB
> Total free: 1789 KB 0%
> Memory accounted for:
> Total accounted: 436218 KB
> memPoolAlloc calls: -2073504971
> memPoolFree calls: -2078299351
> File descriptor usage for squid:
> Maximum number of file descriptors: 8192
> Largest file desc currently in use: 1564
> Number of file desc currently in use: 1508
> Files queued for open: 0
> Available number of file descriptors: 6684
> Reserved number of file descriptors: 100
> Store Disk files open: 47
>
> If I am to stop squid with -k shutdown, the paged memory dissapears except
> for about 2Mb. I can then re-start squid again and run for a few days
> before my swap gets exhausted again. I NEVER need to reboot the machine.
>
> I tried using dlmalloc, gnumalloc and no memory pooling and in all cases I
> have the same results.
>
> Any ideas?

 From the PS listing, it seems that SQUID's size is lot's bigger, then
 the resident set size. Will lead to swapping indeed.

 How big is the total of your cache_dir's ?

 Check the FAQ on mem. usage versus specified cach_dir size(s).

 Advise : reduce cache_mem setting in squid.conf to 32 or 64Mb as
 first test.

 M.

>
> Thanks
>
> Ron
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus

-- 
 'Time is a consequence of Matter thus
 General Relativity is a direct consequence of QM
 (M.E. Mar 2002)
Received on Mon Jan 20 2003 - 09:42:20 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:12:44 MST