You are not logged in.

#1 2010-08-10 09:34:16

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

[SOLVED] Memory usage

Hi,

My mediaserver (Intel C2D 8400 with 4GB of mem) runs headless on Arch linux 64bit and is fully up to date. Since I noticed that transcoding and streaming videofiles with ps3mediaserver (pms) returned 'out-of-memory'-errors, I contacted the devs of pms about a possible memory leak in their java-based app. I was not the only one, so it might be a problem with pms.

However, I dug a little deeper to find out that (using 'top' and 'free'):
1. PMS reserved 1 GB of memory. Killing it returned that 1GB of memory to the pool of available mem
2. Without PMS and without java loaded, my server is still using about 2.85GB of memory!?

Output of top (ranked by usage of physical memory):

top - 11:24:52 up 37 days, 23:13,  1 user,  load average: 0.00, 0.08, 0.13
Tasks: 100 total,   1 running,  99 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3953136k total,  2851392k used,  1101744k free,    86884k buffers
Swap:  4095996k total,        0k used,  4095996k free,  2547924k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                              
 1963 root      20   0  177m 4636 2660 S    0  0.1   0:13.56 httpd                                                                                
32328 root      20   0 67440 3208 2556 S    0  0.1   0:00.00 sshd                                                                                 
26201 http      20   0  177m 2748  680 S    0  0.1   0:00.00 httpd                                                                                
26202 http      20   0  177m 2688  692 S    0  0.1   0:00.00 httpd                                                                                
26203 http      20   0  177m 2688  692 S    0  0.1   0:00.00 httpd                                                                                
26204 http      20   0  177m 2688  692 S    0  0.1   0:00.00 httpd                                                                                
26205 http      20   0  177m 2688  692 S    0  0.1   0:00.00 httpd                                                                                
26206 http      20   0  177m 2688  692 S    0  0.1   0:00.00 httpd                                                                                
32338 root      20   0 15620 2216 1520 S    0  0.1   0:00.03 bash                                                                                 
32331 vincent   20   0 15608 2068 1408 S    0  0.1   0:00.00 bash                                                                                 
 1447 root      20   0 28584 1708  952 S    0  0.0   0:02.20 syslog-ng                                                                            
32330 vincent   20   0 67596 1644  976 S    0  0.0   0:00.13 sshd                                                                                 
 1948 root      20   0 30164 1568 1032 S    0  0.0   0:22.33 ntpd                                                                                 
 1887 root      20   0 54556 1348  628 S    0  0.0   0:00.03 rpc.mountd                                                                           
32337 root      20   0 22708 1188  860 S    0  0.0   0:00.00 su                                                                                   
 1835 root      20   0 54192 1168  620 S    0  0.0   0:00.00 rpc.statd                                                                            
  648 root      20   0 10748 1104  828 R    0  0.0   0:00.18 top                                                                                  
 1957 root      20   0 52428 1104  572 S    0  0.0   0:00.00 sshd                                                                                 
 1823 root      20   0 47940 1028  496 S    0  0.0   0:00.63 rpcbind                                                                              
  704 root      16  -4  6176  784  420 S    0  0.0   0:00.03 udevd                                                                                
 1853 root      20   0 22876  756  544 S    0  0.0   0:00.00 rpc.idmapd                                                                           
 1921 root      20   0  5988  640  524 S    0  0.0   0:01.21 crond                                                                                
    1 root      20   0  3892  596  500 S    0  0.0   0:05.20 init                                                                                 
 1478 root      20   0  3884  576  464 S    0  0.0   0:00.00 acpid                                                                                
 1932 root      20   0  3888  564  472 S    0  0.0   0:00.00 agetty                                                                               
 1931 root      20   0  3888  560  472 S    0  0.0   0:00.00 agetty                                                                               
 1933 root      20   0  3888  560  472 S    0  0.0   0:00.00 agetty                                                                               
 1934 root      20   0  3888  560  472 S    0  0.0   0:00.00 agetty                                                                               
 1935 root      20   0  3888  560  472 S    0  0.0   0:00.00 agetty                                                                               
 1936 root      20   0  3888  560  472 S    0  0.0   0:00.00 agetty                                                                               
 1446 root      20   0 26092  448  116 S    0  0.0   0:00.00 syslog-ng                                                                            
 1809 root      20   0  8200  340  200 S    0  0.0   0:02.65 dhcpcd                                                                               
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd                                                                             
    3 root      RT   0     0    0    0 S    0  0.0   0:00.09 migration/0                                                                          
    4 root      20   0     0    0    0 S    0  0.0   0:00.29 ksoftirqd/0                                                                          
    5 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0                                                                           
    6 root      RT   0     0    0    0 S    0  0.0   0:00.09 migration/1                                                                          
    7 root      20   0     0    0    0 S    0  0.0   0:00.54 ksoftirqd/1                                                                          
    8 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1                                                                           
    9 root      20   0     0    0    0 S    0  0.0   0:06.60 events/0                                                                             
   10 root      20   0     0    0    0 S    0  0.0   0:40.54 events/1                                                                             
   11 root      20   0     0    0    0 S    0  0.0   0:00.00 cpuset                                                                               
   12 root      20   0     0    0    0 S    0  0.0   0:00.00 khelper                                                                              
   13 root      20   0     0    0    0 S    0  0.0   0:00.00 netns                                                                                
   14 root      20   0     0    0    0 S    0  0.0   0:00.00 async/mgr                                                                            
   15 root      20   0     0    0    0 S    0  0.0   0:00.00 pm

As you can see, There is nothing worth mentioning that is running on the server, aside from some sleeping processes (aside from this ssh-session, there should not be running anything). And still 'free' returns that 2.85GB is in use at the moment...

I thought about the possibility that that number is not really trustworthy, but then again: the transcoding errors were very real (video was skipping). Is there something wrong with my settings? How can I explore per-process memory usage?

THX!

Last edited by zenlord (2010-08-10 10:17:54)

Offline

#2 2010-08-10 09:38:59

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Memory usage

Run 'free -m'; much of that memory is probably just cached.

Offline

#3 2010-08-10 09:47:30

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: [SOLVED] Memory usage

Thx, but I don't think that changes anything (apart from the notation in MB instead of KB):

# free -m
             total       used       free     shared    buffers     cached
Mem:          3860       2784       1076          0         84       2488
-/+ buffers/cache:        211       3649
Swap:         3999          0       3999

/EDIT: wait: the second line states that only 211MB is in use - is that the 'real usage'?

Last edited by zenlord (2010-08-10 09:49:25)

Offline

#4 2010-08-10 09:50:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Memory usage

-/+ buffers/cache:        211       3649

It means you actively use 211 MB of memory and if you want to free that, you need to close some apps. The rest (2784 minus 211) is just buffers and cache.

Please read the wiki, it's all there, it's a common misconception that you somehow use heaps of RAM.

Offline

#5 2010-08-10 10:17:29

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: [SOLVED] Memory usage

karol wrote:

Please read the wiki, it's all there, it's a common misconception that you somehow use heaps of RAM.

I will of course do that - it's just that in my case, one of the processes errored out with a not-enough-memory after running it for about 1 minute. That means my memory is being used by other apps, or that that 1 app is able to fill my memory *very* quickly...

THX for the help!

Offline

#6 2010-08-10 10:24:42

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Memory usage

zenlord wrote:
karol wrote:

Please read the wiki, it's all there, it's a common misconception that you somehow use heaps of RAM.

I will of course do that - it's just that in my case, one of the processes errored out with a not-enough-memory after running it for about 1 minute. That means my memory is being used by other apps, or that that 1 app is able to fill my memory *very* quickly...

THX for the help!

You posted the output of top "Without PMS and without java loaded" and - not surprisingly - your system alone uses very little RAM. I think you should investigate that alleged pms+java leak - I'd hate to waste lots of yummy coffee ;P

Offline

#7 2010-08-10 10:40:03

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: [SOLVED] Memory usage

karol wrote:

You posted the output of top "Without PMS and without java loaded" and - not surprisingly - your system alone uses very little RAM. I think you should investigate that alleged pms+java leak - I'd hate to waste lots of yummy coffee ;P

Yes - I posted that already to the pms-forums. Thx to you, I can safely rule out anything server-related. This is either a transcode-settings-problem, or a memory-leak in pms.

For future reference (and maybe to help other Archers with similar problems):
http://www.ps3mediaserver.org/forum/vie … 798#p34798

Offline

#8 2010-08-10 10:46:01

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Memory usage

zenlord wrote:
karol wrote:

You posted the output of top "Without PMS and without java loaded" and - not surprisingly - your system alone uses very little RAM. I think you should investigate that alleged pms+java leak - I'd hate to waste lots of yummy coffee ;P

Yes - I posted that already to the pms-forums. Thx to you, I can safely rule out anything server-related. This is either a transcode-settings-problem, or a memory-leak in pms.

For future reference (and maybe to help other Archers with similar problems):
http://www.ps3mediaserver.org/forum/vie … 798#p34798

Do you have htop installed? Install it, run it and run you app. Keep an eye for your app's memory usage (you can mark a process by pressing space in the htop window), it will make it easier to follow).

Offline

Board footer

Powered by FluxBB