[squid-users] Squid memory leak on ubuntu 14.04

风声 fengsheng.10 at gmail.com
Mon Nov 30 02:19:47 UTC 2015


I try to use jemalloc, but from monitoring, there is no difference,

I follow this guide:
https://github.com/jemalloc/jemalloc/wiki/Getting-Started

I used LD_PRELOAD to let squid use jemalloc.

is there something wrong ?

If I want to re-compile squid with jemalloc, how can i do that ? Can I just
use some FLAGS ?



2015-11-28 0:23 GMT+08:00 Marcus Kool <marcus.kool at urlfilterdb.com>:

> I do not have the detail of Ubuntu 14.04 but most likely 12.04 and 14.04
> have a different version of malloc (see "man malloc") which allocates
> gigabytes of virtual memory.
> Most likely you see in top that the resident memory is what you expect
> that Squid uses (comparable as on 12.04) and the virtual memory is high.
> This is the new "normal" behavior of malloc.
>
> Marcus
>
>
> On 11/27/2015 01:41 PM, 风声 wrote:
>
>> Hi,
>>
>> We had installed squid 3.3.8 on ubuntu 12.04, when we upgrade the OS from
>> ubuntu 12.04 to 14.04, we found the memory usage abnormal, eat up all
>> memory.
>>
>> After we investigation:
>>
>> We use 4 servers for comparision:
>>
>> 3.3.8 on ubuntu 12.04
>> 3.5.11 on ubuntu 12.04
>>
>> 3.3.8 on ubuntu 14.04
>> 3.5.11 on ubuntu 14.04
>>
>> all squid on ubuntu 12.04 works normal, all squid on ubuntu 14.04 memory
>> usage always keep going up, never goes down. But when I check the system
>> info, can not find where the memory was used. If we
>> restart the squid service, the memory comes back.
>>
>>
>> Can you give me any hints ?
>>
>> Below is the info on abnormal server:
>>
>> *lsb_release -a*
>> No LSB modules are available.
>> Distributor ID:Ubuntu
>> Description:Ubuntu 14.04.3 LTS
>> Release:14.04
>> Codename:trusty
>>
>> *free -m*
>>               total       used       free     shared    buffers     cached
>> Mem:          7480       6405       1074          0        222        668
>> -/+ buffers/cache:       5513       1966
>> Swap:            0          0          0
>>
>> *cat /proc/meminfo*
>>
>> MemTotal:        7659544 kB
>> MemFree:         1107944 kB
>> Buffers:          228352 kB
>> Cached:           685076 kB
>> SwapCached:            0 kB
>> Active:          1373880 kB
>> Inactive:         199260 kB
>> Active(anon):     663652 kB
>> Inactive(anon):      316 kB
>> Active(file):     710228 kB
>> Inactive(file):   198944 kB
>> Unevictable:        5300 kB
>> Mlocked:            5300 kB
>> SwapTotal:             0 kB
>> SwapFree:              0 kB
>> Dirty:               128 kB
>> Writeback:             0 kB
>> AnonPages:        665056 kB
>> Mapped:            21012 kB
>> Shmem:               712 kB
>> Slab:             332904 kB
>> SReclaimable:      77376 kB
>> SUnreclaim:       255528 kB
>> KernelStack:        1368 kB
>> PageTables:         5068 kB
>> NFS_Unstable:          0 kB
>> Bounce:                0 kB
>> WritebackTmp:          0 kB
>> CommitLimit:     3829772 kB
>> Committed_AS:     864212 kB
>> VmallocTotal:   34359738367 kB
>> VmallocUsed:       22316 kB
>> VmallocChunk:   34359708548 kB
>> HardwareCorrupted:     0 kB
>> AnonHugePages:    587776 kB
>> HugePages_Total:       0
>> HugePages_Free:        0
>> HugePages_Rsvd:        0
>> HugePages_Surp:        0
>> Hugepagesize:       2048 kB
>> DirectMap4k:       51200 kB
>> DirectMap2M:     7944192 kB
>>
>> *cat /proc/net/sockstat*
>> sockets: used 7086
>> TCP: inuse 7173 orphan 354 tw 1995 alloc 7224 mem 455543
>> UDP: inuse 9 mem 4
>> UDPLITE: inuse 0
>> RAW: inuse 1
>> FRAG: inuse 0 memory 0
>>
>>
>> *netstat -na | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'*
>> LAST_ACK 39
>> LISTEN 5
>> SYN_RECV 7
>> CLOSE_WAIT 51
>> ESTABLISHED 6004
>> FIN_WAIT1 314
>> FIN_WAIT2 54
>> SYN_SENT 3
>> TIME_WAIT 1687
>>
>> *slabtop -s c*
>>   Active / Total Objects (% used)    : 602429 / 841775 (71.6%)
>>   Active / Total Slabs (% used)      : 28101 / 28101 (100.0%)
>>   Active / Total Caches (% used)     : 64 / 97 (66.0%)
>>   Active / Total Size (% used)       : 282169.82K / 328114.05K (86.0%)
>>   Minimum / Average / Maximum Object : 0.01K / 0.39K / 8.00K
>>
>>    OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
>>   37136  37003  99%    4.00K   4642        8    148544K kmalloc-4096
>> 335283 173366  51%    0.10K   8597       39     34388K buffer_head
>> 104768  94358  90%    0.25K   3274       32     26192K kmalloc-256
>>    9776   7033  71%    2.00K    611       16     19552K kmalloc-2048
>>    9810   6588  67%    1.75K    545       18     17440K TCP
>>   13959  13959 100%    0.96K    423       33     13536K ext4_inode_cache
>>   55083  52199  94%    0.19K   2623       21     10492K dentry
>>   13856   8621  62%    0.50K    433       32      6928K kmalloc-512
>>   52064  49778  95%    0.12K   1627       32      6508K kmalloc-128
>>    9650   6515  67%    0.62K    386       25      6176K sock_inode_cache
>>   18798   8329  44%    0.30K    723       26      5784K
>> nf_conntrack_ffffffff81cdab80
>>   27825  16442  59%    0.19K   1325       21      5300K kmalloc-192
>>    9240   5902  63%    0.55K    330       28      5280K radix_tree_node
>>    7952   7952 100%    0.57K    284       28      4544K inode_cache
>>    2880   1874  65%    1.00K     90       32      2880K kmalloc-1024
>>   16992  16992 100%    0.11K    472       36      1888K sysfs_dir_cache
>>    2875   2875 100%    0.63K    115       25      1840K proc_inode_cache
>>
>>
>> *squid3 -v*
>> Squid Cache: Version 3.5.11
>> Service Name: squid
>> configure options:  '--build=x86_64-linux-gnu' '--prefix=/usr'
>> '--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
>> '--infodir=${prefix}/share/info' '--sysconfdir=/etc'
>> '--localstatedir=/var' '--libexecdir=${prefix}/lib/squid3' '--srcdir=.'
>> '--disable-maintainer-mode' '--disable-dependency-tracking'
>> '--disable-silent-rules' '--datadir=/usr/share/squid3'
>> '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man' '--enable-inline'
>> '--with-aufs-threads=8' '--enable-storeio=ufs,aufs,diskd,rock'
>> '--enable-removal-policies=lru,heap' '--enable-delay-pools'
>> '--enable-cache-digests' '--enable-underscores'
>> '--enable-follow-x-forwarded-for' '--enable-auth-basic=NCSA'
>> '--enable-auth-digest=file' '--enable-htcp'
>> '--enable-url-rewrite-helpers=fake'
>> '--enable-eui' '--enable-esi' '--enable-icmp' '--enable-zph-qos'
>> '--disable-auth-negotiate' '--disable-auth-ntlm' '--disable-ecap'
>> '--disable-external-acl-helpers' '--disable-icap-client'
>> '--disable-ipv6' '--disable-translation'
>> '--with-swapdir=/var/spool/squid3' '--with-logdir=/var/log/squid3'
>> '--with-pidfile=/var/run/squid3.pid' '--with-filedescriptors=100000'
>> '--with-large-files'
>> '--with-default-user=proxy' '--enable-linux-netfilter'
>> 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fPIE -fstack-protector
>> --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
>> 'LDFLAGS=-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now'
>> 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fPIE -fstack-protector
>> --param=ssp-buffer-size=4 -Wformat -Werror=format-security'
>>
>>
>> _______________________________________________
>> squid-users mailing list
>> squid-users at lists.squid-cache.org
>> http://lists.squid-cache.org/listinfo/squid-users
>>
>> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20151130/3410893f/attachment-0001.html>


More information about the squid-users mailing list