View previous topic :: View next topic |
Author |
Message |
dejanb n00b
Joined: 01 Oct 2007 Posts: 5
|
Posted: Mon Oct 01, 2007 11:13 am Post subject: Memory problems |
|
|
Hi,
I have a Gentoo box that runs a Java web application. The problem I experience is that after some time the system goes completely out of memory and the only thing left to do is to restart the server, which is not suitable since it is a production box. Even when there is no applications running except shell, "top" and "free" say that there is no memory left (like this)
total used free shared buffers cached
Mem: 1011 868 142 0 0 8
-/+ buffers/cache: 859 152
Swap: 1913 8 1905
As soon as I start the application, it starts swapping and load on the machine goes up.
Does anyone experienced a situation like this? Any feedback would be appreciated.
Thanks,
Dejan |
|
Back to top |
|
|
mattsteven Apprentice
Joined: 27 Oct 2003 Posts: 240 Location: Your Planet
|
Posted: Mon Oct 01, 2007 1:22 pm Post subject: |
|
|
From "man java"
Code: | -Xmxn Specifies the maximum size, in bytes, of the memory allocation
pool. This value must be a multiple of 1024 greater than 2 MB.
Append the letter k or K to indicate kilobytes or the letter m
or M to indicate megabytes. The default value is 64MB. Exam-
ples:
-Xmx83886080
-Xmx81920k
-Xmx80m |
Set this to something less than your total memory to prevent the bad web app from taking down the system. _________________ Matthew Steven
Linux-only desktop since 1998
Graying hair since 2006 |
|
Back to top |
|
|
dejanb n00b
Joined: 01 Oct 2007 Posts: 5
|
Posted: Mon Oct 01, 2007 1:32 pm Post subject: |
|
|
Quote: | Set this to something less than your total memory to prevent the bad web app from taking down the system. |
Maybe I wasn't clear enough, but the problem is that mem reports that Gentoo alone takes 800 MB of RAM memory which is way too high. I currently run my Java app with the minimum amount of RAM, but there are still problems due to this limited environment (only 200 MB of free RAM is available to the apps).
Thanks,
Dejan |
|
Back to top |
|
|
tarpman Veteran
Joined: 04 Nov 2004 Posts: 1083 Location: Victoria, BC, Canada
|
Posted: Mon Oct 01, 2007 3:58 pm Post subject: |
|
|
Hi,
Can you provide the output of top -bn1? Take a look at the RES column, and see which process(es) is/are taking the most memory. _________________ Saving the world, one kilobyte at a time. |
|
Back to top |
|
|
dejanb n00b
Joined: 01 Oct 2007 Posts: 5
|
Posted: Tue Oct 02, 2007 7:22 am Post subject: |
|
|
tarpman wrote: | Hi,
Can you provide the output of top -bn1? Take a look at the RES column, and see which process(es) is/are taking the most memory. |
Hi,
here's the output of the top just after I shut down the Java app.
Code: |
top - 08:13:34 up 69 days, 15:40, 1 user, load average: 0.99, 0.53, 0.28
Tasks: 80 total, 1 running, 79 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.1% us, 0.1% sy, 0.0% ni, 97.1% id, 1.7% wa, 0.0% hi, 0.0% si
Mem: 1035600k total, 898512k used, 137088k free, 900k buffers
Swap: 1959888k total, 6396k used, 1953492k free, 7864k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 16 0 1424 112 80 S 0.0 0.0 0:01.99 init
2 root RT 0 0 0 0 S 0.0 0.0 0:00.24 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.49 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:00.31 migration/1
5 root 34 19 0 0 0 S 0.0 0.0 0:00.42 ksoftirqd/1
6 root RT 0 0 0 0 S 0.0 0.0 0:40.23 migration/2
7 root 34 19 0 0 0 S 0.0 0.0 0:00.62 ksoftirqd/2
8 root RT 0 0 0 0 S 0.0 0.0 0:00.25 migration/3
9 root 34 19 0 0 0 S 0.0 0.0 0:00.40 ksoftirqd/3
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
11 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/1
12 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/2
13 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/3
14 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 khelper
15 root 10 -5 0 0 0 S 0.0 0.0 0:00.05 kthread
20 root 6 -10 0 0 0 S 0.0 0.0 0:00.00 vesafb
21 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
62 root 10 -5 0 0 0 S 0.0 0.0 1:20.49 kblockd/0
63 root 10 -5 0 0 0 S 0.0 0.0 0:14.53 kblockd/1
64 root 10 -5 0 0 0 S 0.0 0.0 0:07.64 kblockd/2
65 root 10 -5 0 0 0 S 0.0 0.0 0:16.29 kblockd/3
68 root 15 0 0 0 0 S 0.0 0.0 0:00.00 khubd
113 root 15 0 0 0 0 S 0.0 0.0 15:13.73 kswapd0
114 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0
115 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 aio/1
116 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 aio/2
117 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 aio/3
707 root 17 0 0 0 0 S 0.0 0.0 0:00.11 kseriod
776 root 15 0 0 0 0 S 0.0 0.0 0:01.79 kirqd
777 root 15 0 0 0 0 S 0.0 0.0 0:30.21 kjournald
833 root 12 -4 1428 36 32 S 0.0 0.0 0:00.57 udevd
3910 root 15 0 0 0 0 S 0.0 0.0 0:01.06 kjournald
3935 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 user_dlm
6091 root 15 0 1740 200 172 S 0.0 0.0 0:10.14 syslog-ng
10661 root 16 0 10008 556 404 S 0.0 0.1 0:54.58 nscd
10678 root 16 0 10008 556 404 S 0.0 0.1 0:02.79 nscd
10679 root 16 0 10008 556 404 S 0.0 0.1 0:11.92 nscd
10680 root 15 0 10008 556 404 S 0.0 0.1 0:12.95 nscd
10681 root 16 0 10008 556 404 S 0.0 0.1 0:13.15 nscd
10682 root 16 0 10008 556 404 S 0.0 0.1 0:19.99 nscd
10683 root 16 0 10008 556 404 S 0.0 0.1 0:19.97 nscd
10684 root 16 0 10008 556 404 S 0.0 0.1 0:20.07 nscd
11567 proftpd 16 0 4064 252 148 S 0.0 0.0 0:03.72 proftpd
13101 root 16 0 3904 452 320 S 0.0 0.0 0:05.03 sendmail
13260 smmsp 15 0 3744 224 220 S 0.0 0.0 0:00.63 sendmail
14435 root 16 0 3156 240 156 S 0.0 0.0 0:00.21 sshd
20154 root 17 0 1476 148 100 S 0.0 0.0 0:02.69 cron
20369 root 16 0 1416 36 32 S 0.0 0.0 0:00.00 agetty
20370 root 16 0 1416 36 32 S 0.0 0.0 0:00.00 agetty
20371 root 16 0 1416 36 32 S 0.0 0.0 0:00.00 agetty
20372 root 16 0 1420 36 32 S 0.0 0.0 0:00.00 agetty
20373 root 16 0 1420 36 32 S 0.0 0.0 0:00.00 agetty
20688 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 o2net
21462 root 17 0 1788 40 36 S 0.0 0.0 0:00.00 iscsid
21483 root 20 0 1788 40 36 S 0.0 0.0 0:00.00 iscsid
21494 root 21 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_6
21495 root 10 -5 0 0 0 S 0.0 0.0 10:37.67 iscsi-tx
21496 root 10 -5 0 0 0 S 0.0 0.0 12:16.47 iscsi-rx
21511 root 21 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_7
21512 root 10 -5 0 0 0 S 0.0 0.0 6:03.64 iscsi-tx
21513 root 10 -5 0 0 0 S 0.0 0.0 13:49.16 iscsi-rx
21526 root 18 0 1788 40 36 S 0.0 0.0 0:00.00 iscsid
21528 root 21 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_8
21529 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 iscsi-tx
21530 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 iscsi-rx
21698 root 10 -5 0 0 0 S 0.0 0.0 3:09.97 o2hb-F44CDED83F
21706 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 ocfs2_wq
21713 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 ocfs2vote-0
21714 root 10 -5 0 0 0 S 0.0 0.0 3:18.78 dlm_thread
21715 root 10 -5 0 0 0 S 0.0 0.0 0:01.04 dlm_reco_thread
21716 root 18 0 0 0 0 S 0.0 0.0 0:00.00 kjournald
21717 root 10 -5 0 0 0 S 0.0 0.0 0:00.80 ocfs2cmt-0
21852 root 15 0 0 0 0 S 0.0 0.0 1:33.69 kjournald
21854 root 15 0 0 0 0 S 0.0 0.0 0:53.96 kjournald
27644 root 16 0 1420 36 32 S 0.0 0.0 0:00.00 agetty
12903 root 15 0 0 0 0 S 0.0 0.0 0:00.09 pdflush
12922 root 15 0 0 0 0 S 0.0 0.0 0:00.10 pdflush
13338 root 15 0 6120 1256 972 S 0.0 0.1 0:00.18 sshd
13341 root 15 0 2060 1100 932 S 0.0 0.1 0:00.03 bash
13410 root 15 0 1772 800 612 R 0.0 0.1 0:00.00 top
|
As you can see, there is nothing taking a lot of memory and still it seems there is no free memory on the system.
Thanks. |
|
Back to top |
|
|
mattsteven Apprentice
Joined: 27 Oct 2003 Posts: 240 Location: Your Planet
|
Posted: Tue Oct 02, 2007 12:43 pm Post subject: |
|
|
That's just cached memory. It is reported as "used" which is a little misleading, use vmstat to get a more accurate picture of how much of that is cache and how much is actually used.
The usefulness of the cached memory is that when you re-start your app it will initialize noticeably faster. _________________ Matthew Steven
Linux-only desktop since 1998
Graying hair since 2006 |
|
Back to top |
|
|
dejanb n00b
Joined: 01 Oct 2007 Posts: 5
|
Posted: Tue Oct 02, 2007 1:06 pm Post subject: |
|
|
mattsteven wrote: | That's just cached memory. It is reported as "used" which is a little misleading, use vmstat to get a more accurate picture of how much of that is cache and how much is actually used.
The usefulness of the cached memory is that when you re-start your app it will initialize noticeably faster. |
You are right, but I think top and free should report this memory as cached? It says there is only 7MB cached in this case. Unfortunately I've restarted the server and now everything looks fine (reports 700 MB of cached memory).
Thanks,
Dejan |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9890 Location: almost Mile High in the USA
|
Posted: Tue Oct 02, 2007 2:33 pm Post subject: |
|
|
Yeah, it looks suspicious there. Almost seems you have some kernel memory leak - I had a kernel with one of my motherboards that slowly leaked memory in the ACPI code (but now is fixed)... Try upgrading the kernel? what version are you using? _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
dejanb n00b
Joined: 01 Oct 2007 Posts: 5
|
Posted: Fri Oct 05, 2007 9:35 am Post subject: |
|
|
eccerr0r wrote: | Yeah, it looks suspicious there. Almost seems you have some kernel memory leak - I had a kernel with one of my motherboards that slowly leaked memory in the ACPI code (but now is fixed)... Try upgrading the kernel? what version are you using? |
Hi,
sorry for my delayed response. The kernel version is 2.6.12-gentoo-r4. Do you have memory leaks in version newer than this one?
Thanks,
Dejan |
|
Back to top |
|
|
|