LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on...

Notices

Reply
 
LinkBack Search this Thread
Old 08-05-2013, 08:41 PM   #1
danielc1657
LQ Newbie
 
Registered: Aug 2013
Distribution: CentOS 6.4 32 bit
Posts: 3

Rep: Reputation: Disabled
CentOS 6.4 x86_64 uses too much memory and swap


I`ve been surfing the web for about 1 week and everything I`ve found is "centos knows how to use the ram, don`t worry" but I really think this is a problem.
I have a VM with a recent/clean installation of CentOS 6.4 X86_64 final with 1.5GB RAM, 1 processor / 4 cores and 700MB SWAP and the problem is the memory consumption.
I installed postgresql, pgadmin3, JRE 7.25 (NOT JDK nor OpenJDK), netbeans 7.3.1 and apache but most of the time (99%) I only need NB and firefox open at the same time.
Well, when I open netbeans it uses 300Mb - 350MB, and Firefox 100MB - 150MB and the initial memory used by the system is about 250MB, so there are 750MB and the system monitor and free -m command confirm that, but within a few minutes the system eats all my free memory and starts using 100MB - 200MB SWAP And it gets really SssLOOOWWW..
I am developping a simple PHP / JS / HTML website.
When the system eats all my memory and swap, the free -m command returns this:
Code:
free -m
       total    used      free   shared    buffers    cached
Mem: 1511532  1477256    34276      0       18652     89325
-/+ b../c..:  1369279   142253
Swap: 711320   198652   512668
I know the actual free memory is about 140MB but:
  • That is a lot of memory used and the system gets really slow
  • If I close NB and FF I only get half of the memory used by both released (250MB)
  • The SWAP is never released (only on reboot)
  • if I open FF and NB again it consumes the 250MB again and EVEN MORE SWAP!!!
.

Please check what I have done so far:
  • I changed the Swappiness value from 60 to 10 and actually the system doesn`t use the swap until it gets the 90% of the RAM used.
  • I disabled the unnecesary programs at startup like bluetooth mgr, mail, login sound, energy mngr (it is a desktop pc).
  • I set the JVM Max heap size to 256MB and actually between the java/netbeans (Virtual + shared) = actual memory used is never > 400MB
  • If I check service by service (including the multiple httpd and PGSql subservices) the memory used is not more than 750MB
  • I have to say that when I test the exact same website in Win 7 the memory used by Netbeans and Firefox is almost the same as it is in centOS (500MB) and with the initial memory used by the system (900MB) the total used memory is 1400MB and it doesn`t change so is is not a programming error.
  • Finally, I have reinstalled CentOS and the problem persists

Last edited by danielc1657; 08-05-2013 at 08:59 PM.
 
Old 08-06-2013, 12:55 PM   #2
johnsfine
Senior Member
 
Registered: Dec 2007
Distribution: Centos
Posts: 4,963

Rep: Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073
Quote:
Originally Posted by danielc1657 View Post
everything I`ve found is "centos knows how to use the ram, don`t worry" but I really think this is a problem.
I agree with you. Your stats do not fit the common pattern described in the pages that tell you not to worry about it.

Something is using a lot of memory.
Quote:
I installed postgresql, pgadmin3, JRE 7.25 (NOT JDK nor OpenJDK), netbeans 7.3.1 and apache
I don't know about the memory requirements of any of those things. I expect some use a lot of memory just to be there, even if they aren't active.

Quote:
within a few minutes the system eats all my free memory and starts using 100MB - 200MB SWAP And it gets really SssLOOOWWW..
There is probably nothing wrong with using that swap space. There is nothing wrong with cache and buffers using up nearly all your free memory.

The question is what else is using memory. You are focusing on the wrong details, so it is hard to guess at the missing info to diagnose the problem.
Quote:
  • The SWAP is never released (only on reboot)
  • if I open FF and NB again it consumes the 250MB again and EVEN MORE SWAP!!!
The fact that the swap wasn't released means it was used by something large and inactive and NOT FF nor NB. It would be nice to know what is using the swap, but that use of swap is probably NOT responsible for any slow down. Maybe you just should have more swap space and not worry about it getting used.


Quote:
I changed the Swappiness value from 60 to 10 and actually the system doesn`t use the swap until it gets the 90% of the RAM used.

Terrible idea. That makes your performance worse and provides very little diagnostic info.

I don't know enough about VM's anyway, and you didn't provide info on the type and configuration of VM, so I won't have any solid suggestion on that topic. But I wonder whether the VM host is intruding on the VM to soak up any ram it considers excess.

I don't know any easy way to look for excess memory use. I would look at the "slab" info to see whether the kernel itself is using too much memory. I would look and the smaps of individual processes to see what they are really using.
cat /proc/slabinfo
but it isn't easy to interpret
less /proc/pid/smaps
but that is verbose and hard to spot the important parts and you need to start with good guesses of which processes are worth investigation.

Last edited by johnsfine; 08-06-2013 at 01:07 PM.
 
Old 08-07-2013, 11:40 AM   #3
danielc1657
LQ Newbie
 
Registered: Aug 2013
Distribution: CentOS 6.4 32 bit
Posts: 3

Original Poster
Rep: Reputation: Disabled
As I said I reinstalled CentOS x64 and the problem with the memory ussage persists so I have a theory for my own specific case and from my own experience.
If you are not totally sure that your programs/applications are designed for 64 bits you better install 32 bit CentOS -- I Did it.
My case:
Quote:
  • Amd Athlon X4 640 Processor (64bit)
  • VMware 7
  • 1 processor / 4 cores, 1.5GB RAM
  • CentOS 6.4 32bit
  • apache (httpd)
  • Php 5.3.3
  • Postgresql, (server, client, contrib, libpq)
  • pgAdmin III
  • Firefox 17 ESR (default centos browser after first Update) with firebug and colorzilla extensions
  • Opera (Last release)
  • JRE 7.25 (Only for netbeans to work -- Downloaded from Oracle not openJDK)
  • Netbeans 7.3.1 (PHP - HTML5)
Now I have opened pgadmin, netbeans (with 10 active tabs) and firefox and the free memory is (150+MB free + 20+MB buffers + 200+MB cached) and if I need more memory when I open opera or any other program some of the cached memory is released AS IT SHOULD BE DONE.
oh, and the SWAP use is 0.00000000 that as you know it can be really helpful but if you are using a program loaded in the swap (totally or partially) it is at least 10 times slower than a program loaded in the RAM.
Disclaimer: This works for me in a Virtual machine, not a production server in other conditions. I don`t have enough experience to recommend this for everyone.

Last edited by danielc1657; 08-07-2013 at 09:33 PM.
 
Old 08-07-2013, 01:50 PM   #4
johnsfine
Senior Member
 
Registered: Dec 2007
Distribution: Centos
Posts: 4,963

Rep: Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073Reputation: 1073
Quote:
Originally Posted by danielc1657 View Post
If you are not totally sure that your programs/applications are designed for 64 bits you better install 32 bit CentOS.
I don't think that is a generally useful suggestion.

Using 32-bit applications on a 64-bit Linux does use a LITTLE extra ram compared to using the same applications on a 32-bit Linux. So if you are seriously constrained in ram, that may be a reason to select a 32-bit OS. But 1.5GB ought to be above the range where that is a significant issue.

I still don't know the specifics of your problem. But I doubt any mixing of 32/64 bit is a significant factor.
 
Old 08-07-2013, 02:35 PM   #5
danielc1657
LQ Newbie
 
Registered: Aug 2013
Distribution: CentOS 6.4 32 bit
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks johnsfine
Quote:
Originally Posted by johnsfine View Post
I don't think that is a generally useful suggestion.
That is why I said "for my own specific case and from my own experience"
Quote:
Originally Posted by johnsfine View Post
I still don't know the specifics of your problem. But I doubt any mixing of 32/64 bit is a significant factor.
When I had the 64 bit version I had the exact same configuration that I have now, with the same programs and services running- Also I reinstalled the 64bit version and I had the same problem, so I decided to install the 32bit version.
I don`t know what happened before but now it works perfect.
Disclaimer: This works for me in a Virtual machine, not a production server in other conditions. I don`t have enough experience to recommend this for everyone.
Thanks.

Last edited by danielc1657; 08-07-2013 at 09:24 PM.
 
  


Reply

Tags
centos6, memoryleak


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Live DVD runs out of memory - using swap - free memory doesn't help at upgrade .... LiNuXkOlOnIe Linux - Distributions 3 06-09-2013 09:35 PM
How to increase the swap memory for mysql in centos 6.2 arun5002 Linux - Server 3 06-14-2012 05:57 AM
Didnt use swap memory in CentOS 5.4 casualzone Linux - Software 2 02-27-2010 08:42 PM
LXer: Xen 3.2 on CentOS 5.2 x86_64 / RHEL 5.2 x86_64 LXer Syndicated Linux News 0 07-12-2008 05:51 PM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM


All times are GMT -5. The time now is 04:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration