Jdesk / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

Starting memcached from cron or sudo eats 1.5GB Virtual Memory #162

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Start memcached using "sudo memcached" or starting from crontab

What is the expected output? What do you see instead?
I see the VSZ usage at 1.5GB instead of few MB.

What version of the product are you using? On what operating system?
RHEL5
Memcached 1.4.5
Libevent 1.4.13-1

Original issue reported on code.google.com by ferranbo...@gmail.com on 10 Nov 2010 at 12:59

GoogleCodeExporter commented 9 years ago
I tried to reproduce this on Solaris, but I failed..

from ./memcached:
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
 29112 trond    4324K 2676K sleep   59    0   0:00:00 0,0% memcached/6

from ./memcached -u nobody:
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
 29117 nobody   4392K 2740K sleep   59    0   0:00:00 0,0% memcached/6

I assume that the small increase here is caused caused by calling the password 
functions.

Could you try to provide the address mappings from your application?

Original comment by trond.no...@gmail.com on 10 Nov 2010 at 1:42

GoogleCodeExporter commented 9 years ago
[root@em-lam-front-01 ~]# memcached -d -p 11211 -u memcached -m 2048 -c 65535 
-P /var/run/memcached/memcached.pid -l 10.13.0.120
[root@em-lam-front-01 ~]# ps waux |grep mem
100      16481  0.0  0.0  53952   692 ?        Ssl  12:09   0:00 memcached -d 
-p 11211 -u memcached -m 2048 -c 65535 -P /var/run/memcached/memcached.pid -l 
10.13.0.120

----------------
[root@em-lam-front-01 ~]# sudo memcached -d -p 11211 -u memcached -m 2048 -c 
65535 -P /var/run/memcached/memcached.pid -l 10.13.0.120
[root@em-lam-front-01 ~]# ps waux |grep mem
100      16977  0.5  0.2 1531228 17284 ?       Ssl  12:09   0:00 memcached -d 
-p 11211 -u memcached -m 2048 -c 65535 -P /var/run/memcached/memcached.pid -l 
10.13.0.120

Original comment by ferranbo...@gmail.com on 10 Nov 2010 at 3:10

GoogleCodeExporter commented 9 years ago
Here isthe pmap of the daemon with high virtual mem usage:
16977:   memcached -d -p 11211 -u memcached -m 2048 -c 65535 -P 
/var/run/memcached/memcached.pid -l 10.13.0.120
Address   Kbytes     RSS    Anon  Locked Mode   Mapping
0079d000       4       -       -       - r-x--    [ anon ]
0098d000     104       -       -       - r-x--  ld-2.5.so
009a7000       4       -       -       - r----  ld-2.5.so
009a8000       4       -       -       - rw---  ld-2.5.so
009ab000    1276       -       -       - r-x--  libc-2.5.so
00aea000       4       -       -       - -----  libc-2.5.so
00aeb000       8       -       -       - r----  libc-2.5.so
00aed000       4       -       -       - rw---  libc-2.5.so
00aee000      12       -       -       - rw---    [ anon ]
00af3000     100       -       -       - r-x--  libevent-1.4.so.2.1.3
00b0c000       4       -       -       - rw---  libevent-1.4.so.2.1.3
00b83000      80       -       -       - r-x--  libpthread-2.5.so
00b97000       4       -       -       - r----  libpthread-2.5.so
00b98000       4       -       -       - rw---  libpthread-2.5.so
00b99000       8       -       -       - rw---    [ anon ]
00bb2000      28       -       -       - r-x--  librt-2.5.so
00bb9000       4       -       -       - r----  librt-2.5.so
00bba000       4       -       -       - rw---  librt-2.5.so
00cec000      76       -       -       - r-x--  libnsl-2.5.so
00cff000       4       -       -       - r----  libnsl-2.5.so
00d00000       4       -       -       - rw---  libnsl-2.5.so
00d01000       8       -       -       - rw---    [ anon ]
00d05000      60       -       -       - r-x--  libresolv-2.5.so
00d14000       4       -       -       - r----  libresolv-2.5.so
00d15000       4       -       -       - rw---  libresolv-2.5.so
00d16000       8       -       -       - rw---    [ anon ]
00ea6000      36       -       -       - r-x--  libnss_files-2.5.so
00eaf000       4       -       -       - r----  libnss_files-2.5.so
00eb0000       4       -       -       - rw---  libnss_files-2.5.so
08048000      80       -       -       - r-x--  memcached
0805c000       4       -       -       - rw---  memcached
0805d000      16       -       -       - rw---    [ anon ]
09a25000    2536       -       -       - rw---    [ anon ]
4f528000   30600       -       -       - rw---    [ anon ]
5130a000       4       -       -       - -----    [ anon ]
5130b000  302400       -       -       - rw---    [ anon ]
63a5b000       4       -       -       - -----    [ anon ]
63a5c000  302400       -       -       - rw---    [ anon ]
761ac000       4       -       -       - -----    [ anon ]
761ad000  302400       -       -       - rw---    [ anon ]
888fd000       4       -       -       - -----    [ anon ]
888fe000  302400       -       -       - rw---    [ anon ]
9b04e000       4       -       -       - -----    [ anon ]
9b04f000  302672       -       -       - rw---    [ anon ]
bf9bd000      88       -       -       - rw---    [ stack ]
-------- ------- ------- ------- -------
total kB 1547484       -       -       -

Original comment by ferranbo...@gmail.com on 10 Nov 2010 at 3:16

GoogleCodeExporter commented 9 years ago
And the one with the 80Mb:
22184:   memcached -d -p 11211 -u memcached -m 2048 -c 65535 -P 
/var/run/memcached/memcached.pid -l 10.13.0.120
Address   Kbytes     RSS    Anon  Locked Mode   Mapping
00841000      36       -       -       - r-x--  libnss_files-2.5.so
0084a000       4       -       -       - r----  libnss_files-2.5.so
0084b000       4       -       -       - rw---  libnss_files-2.5.so
0098d000     104       -       -       - r-x--  ld-2.5.so
009a7000       4       -       -       - r----  ld-2.5.so
009a8000       4       -       -       - rw---  ld-2.5.so
009ab000    1276       -       -       - r-x--  libc-2.5.so
00aea000       4       -       -       - -----  libc-2.5.so
00aeb000       8       -       -       - r----  libc-2.5.so
00aed000       4       -       -       - rw---  libc-2.5.so
00aee000      12       -       -       - rw---    [ anon ]
00af3000     100       -       -       - r-x--  libevent-1.4.so.2.1.3
00b0c000       4       -       -       - rw---  libevent-1.4.so.2.1.3
00b83000      80       -       -       - r-x--  libpthread-2.5.so
00b97000       4       -       -       - r----  libpthread-2.5.so
00b98000       4       -       -       - rw---  libpthread-2.5.so
00b99000       8       -       -       - rw---    [ anon ]
00bb2000      28       -       -       - r-x--  librt-2.5.so
00bb9000       4       -       -       - r----  librt-2.5.so
00bba000       4       -       -       - rw---  librt-2.5.so
00cec000      76       -       -       - r-x--  libnsl-2.5.so
00cff000       4       -       -       - r----  libnsl-2.5.so
00d00000       4       -       -       - rw---  libnsl-2.5.so
00d01000       8       -       -       - rw---    [ anon ]
00d05000      60       -       -       - r-x--  libresolv-2.5.so
00d14000       4       -       -       - r----  libresolv-2.5.so
00d15000       4       -       -       - rw---  libresolv-2.5.so
00d16000       8       -       -       - rw---    [ anon ]
00ef9000       4       -       -       - r-x--    [ anon ]
08048000      80       -       -       - r-x--  memcached
0805c000       4       -       -       - rw---  memcached
0805d000      16       -       -       - rw---    [ anon ]
083a2000    1052       -       -       - rw---    [ anon ]
b347a000   25548       -       -       - rw---    [ anon ]
b4d6d000       4       -       -       - -----    [ anon ]
b4d6e000   10240       -       -       - rw---    [ anon ]
b576e000       4       -       -       - -----    [ anon ]
b576f000   10240       -       -       - rw---    [ anon ]
b616f000       4       -       -       - -----    [ anon ]
b6170000   10240       -       -       - rw---    [ anon ]
b6b70000       4       -       -       - -----    [ anon ]
b6b71000   10240       -       -       - rw---    [ anon ]
b7571000       4       -       -       - -----    [ anon ]
b7572000   10512       -       -       - rw---    [ anon ]
bfdd8000      84       -       -       - rw---    [ stack ]
-------- ------- ------- ------- -------
total kB   80144       -       -       -

Original comment by ferranbo...@gmail.com on 10 Nov 2010 at 3:18

GoogleCodeExporter commented 9 years ago
I'm not able to repro this on my set-up either:

# uname -a
Linux alex-studio 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC 2011 
i686 GNU/Linux

# ./memcached -d -p 11211 -u nobody -m 2048 -c 65535 -P 
/var/run/memcached/memcached.pid

# ps waux | grep mem
nobody   20429  0.0  0.0  45932   932 ?        Ssl  13:09   0:00 ./memcached -d 
-p 11211 -u nobody -m 2048 -c 65535 -P /var/run/memcached/memcached.pid

# killall memcached

# sudo ./memcached -d -p 11211 -u nobody -m 2048 -c 65535 -P 
/var/run/memcached/memcached.pid

# ps waux | grep mem
nobody   20440  0.0  0.0  45048   928 ?        Ssl  13:10   0:00 ./memcached -d 
-p 11211 -u nobody -m 2048 -c 65535 -P /var/run/memcached/memcached.pid

# 

In fact, the memory utilization appears to be lower when memcached is started 
with sudo.

Original comment by amord...@gmail.com on 25 Mar 2011 at 5:17

GoogleCodeExporter commented 9 years ago
Also (and forgive me if this is obvious, as I'm new to this), why would you 
want to run 'sudo memcached' if you're already root?

Original comment by amord...@gmail.com on 25 Mar 2011 at 5:19

GoogleCodeExporter commented 9 years ago
Is this related to bug186?

Original comment by dsalli...@gmail.com on 25 Mar 2011 at 5:50

GoogleCodeExporter commented 9 years ago
Certainly thread stack size related:

$ ulimit -s 16000

$ ./memcached -d -p 11211 -u nobody -m 2048 -P /var/run/memcached/memcached.pid

$ ps waux | grep mem
alex      3505  0.0  0.0  84848   908 ?        Ssl  14:41   0:00 ./memcached -d 
-p 11211 -u nobody -m 2048 -P /var/run/memcached/memcached.pid
$ pmap 3505
3505:   ./memcached -d -p 11211 -u nobody -m 2048 -P 
/var/run/memcached/memcached.pid

[...]

b2a2a000      4K -----    [ anon ]
b2a2b000  16000K rw---    [ anon ]
b39cb000      4K -----    [ anon ]
b39cc000  16000K rw---    [ anon ]
b496c000      4K -----    [ anon ]
b496d000  16000K rw---    [ anon ]
b590d000      4K -----    [ anon ]
b590e000  16000K rw---    [ anon ]
b68ae000      4K -----    [ anon ]
b68af000  16272K rw---    [ anon ]
b78a7000      8K rw---    [ anon ]
bffc7000     84K rw---    [ stack ]
 total    84844K

$ ulimit -s 8192

$ ./memcached -d -p 11211 -u nobody -m 2048 -P /var/run/memcached/memcached.pid

$ ps waux | grep mem
alex      3326  0.0  0.0  45808   908 ?        Ssl  14:31   0:00 ./memcached -d 
-p 11211 -u nobody -m 2048 -P /var/run/memcached/memcached.pid

$ pmap 3326
3326:   ./memcached -d -p 11211 -u nobody -m 2048 -P 
/var/run/memcached/memcached.pid

[...]

b4f4f000      4K -----    [ anon ]
b4f50000   8192K rw---    [ anon ]
b5750000      4K -----    [ anon ]
b5751000   8192K rw---    [ anon ]
b5f51000      4K -----    [ anon ]
b5f52000   8192K rw---    [ anon ]
b6752000      4K -----    [ anon ]
b6753000   8192K rw---    [ anon ]
b6f53000      4K -----    [ anon ]
b6f54000   8464K rw---    [ anon ]
b77ac000      8K rw---    [ anon ]
bf843000     84K rw---    [ stack ]
 total    45804K
$

So sounds like a (mis)configuration issue on the OP's end?

Original comment by amord...@gmail.com on 25 Mar 2011 at 6:48

GoogleCodeExporter commented 9 years ago
I'm going to close this... users with weird platforms should use ulimit -s to 
avoid excessive thread pain :/

Original comment by dorma...@rydia.net on 9 Aug 2011 at 7:06