someone please explain me what's the difference b/w rss and swap in PRSTAT.
i'm getting output like below,
NPROC USERNAME SWAP RSS MEMORY TIME CPU
70 weblogic 48G 46G 73% 449:17:03 0.4%
swap always remains 48G, but rss will change frequently,, now, there is a difference of 2GB in b/w swap and rss, that means weblogic can use another 2GB??
swap it the size of the process virtual memory space (includes RAM but also swap area and unused yet reserved space)
rss is the subset of the former metric currently stored in RAM.
Then RSS can utilize/extend to maximum size of memory in SWAP ... correct ??
here my scenario is, some of the processes are getting crashed when RSS size almost reaches SWAP size, then it cannot allocate new memory in it..
correct me if im wrong..
That's right. The operating system tries to avoid this situation by paging (and swapping). But if a process protects too much of it's address space against paging, it sometimes has a really hard time to do so.
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
12503 weblogic 3048M 2968M sleep 59 0 6:32:06 0.1% java/150
so, if it RSS reaches SIZE , then OS tries to use the new memory in swap. here, can't we manually increase the size of the process. OR any parameter to limit the process size , so that we can increase it.
The RSS value is always less than or equal than the SWAP value, but both of these are dynamic.
SWAP is not a hard limit as the process is free to allocate more memory, i.e. increase its prtstat SWAP value.
Your process should be able to allocate more virtual memory unless the OS has no more virtual memory free or if the process itself has a hard limit configured (eg: java -Xmx).
Use "swap -s" to figure it out.
Most processes have no hard limit configured.
32-bit processes have a 4 GiB technical limit.
Java processes (JVMs) have a hard limit for their heap size set with the -Xmx option. It is normally set in the script that launch them.
Please post:
ptree pid
pargs -a pid
output after replacing pid by the process id of the java command you are investigating (was 12503).