Current time: 04-26-2024, 08:59 PM Hello There, Guest! (LoginRegister)


Post Reply 
Exsessive memory usage.
Author Message
bigbob85 Offline
Junior Member
*

Posts: 11
Joined: Jul 2009
Reputation: 0
Post: #1
Exsessive memory usage.
Hey, im running a debian lenny VPS. I havnt done much to it, except install isp-control and its required packages, but im having problems with it using all my 512MB ram.

NOTE: For ram values, im using the figure given by htop

My server was running at about 508/512MB, and I couldnt get to many pages, they'd complain about memory problems. I have currently got 3 domains installed, 0 of which are actualy set up properly yet, just default stuff.
I have also created 2 databases. One small one, and one that has a small phpbb3 forum.

I tried figuring out what was using all my ram, and seeing as mysqld was running with 16 threads, I did a
Quote:/etc/init.d/mysql stop
and it brought my memory down to 335MB (change of 173MB)

I also noticed several apache threads, so I did
Quote:/etc/init.d/apache2 stop
And this brought my memory down to 199 MB (change of 136MB)

htop also lists alot of php5-cgi threads, so I killed them all...
Quote:killall php5-cgi
And this brought my memory down to 37MB (change of 162MB)


My server is pretty useless without apache and mysql, any tips on why they are running so badly?

Also, I did 1 thing differently in the install, I did apache-mpm-prefork instead of apache-mpm-worker, because it wouldnt start the other way around (not enough memory).


EDIT:
I had my thoughts about apache-mpm-worker/prefork so I did
Quote:aptitude install apache-mpm-worker
After it installed, and removed apache-mpm-prefork, I started apache
Quote:/etc/init.d/apache2 start
And it bought my memory back up to 331MB (change in 294MB)


EDIT2: After a reboot and letting it sit for a while, it idles at about 432MB.
(This post was last modified: 07-12-2009 09:13 PM by bigbob85.)
07-12-2009 05:42 PM
Find all posts by this user Quote this message in a reply
jim.thornton Offline
Junior Member
*

Posts: 29
Joined: Jul 2009
Reputation: 0
Post: #2
RE: Exsessive memory usage.
I had a similar issue but came to realize that the memory was being cached and wasn't actually being used.

If you run # top, what is the output?

If you run # free, what is the output?
08-03-2009 04:56 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #3
RE: Exsessive memory usage.
Linux (or the daemons) always uses as much memory as it can... - why not use memory that is available?

I have a machine with 4GB, 4 sites running, about 60MB free:
Code:
Memory:      Total        Used        Free      Shared     Buffers
Mem:       4031500     3970748       60752           0      573896

of course you have to try to configure the services so they can share the 512MB which is not very much.
Mysql should not use to much (you have to configure this) and apache may use the remaining...

/J
08-03-2009 06:11 AM
Visit this user's website Find all posts by this user Quote this message in a reply
MasterTH Offline
Member
***

Posts: 570
Joined: Feb 2009
Reputation: 4
Post: #4
RE: Exsessive memory usage.
using all memory has one benefit. if a user calls a website that needs mysql-data then mysql collects the data and keep that in memory. When the same website is called again mysql has the needed data in his memory so the user hasn't wait as long as the first did.
I like that kind of memory-management because the Programms usw... are opening the second time really fast.
08-03-2009 02:26 PM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #5
RE: Exsessive memory usage.
Limiting mysql's cache is not as bad as it sounds. Free ram will then be used as a disk cache by the OS, so if mysql disn't cache a query but the corresponding files are in the disk cache (stored in RAM), the query will run really fast. I tend to prefer the disk cache way because it can also be used for other things, while memory reserved for mysql can be used only by mysql itself...
08-04-2009 06:56 AM
Visit this user's website Find all posts by this user Quote this message in a reply
jim.thornton Offline
Junior Member
*

Posts: 29
Joined: Jul 2009
Reputation: 0
Post: #6
RE: Exsessive memory usage.
How do you limit mysql cache? And what should it be limited to?
08-04-2009 08:03 AM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #7
RE: Exsessive memory usage.
It's ok as per default ispcp installation (little reserved memory for caching), but can be modified in /etc/mysql/my.cnf:
Code:
phoenix ~ # cat /etc/mysql/my.cnf | grep cache
thread_cache_size    = 8
#table_cache            = 64
query_cache_limit       = 1M
query_cache_size        = 16M

You can google around about mysql performance to see what all these numbers mean, which values should you use for your workload, etc. I personally have lost a lot of time fiddling with mysql setup, and never saw significant advantages against the deafault configuration.
08-04-2009 03:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
tuxStyle Offline
Junior Member
*

Posts: 37
Joined: May 2009
Reputation: 0
Post: #8
RE: Exsessive memory usage.
You can uncomment : skip-innodb (if you don't use it)
in your /etc/mysql/my.cnf and you will get ~100Mb more.

My VPS has 512Mb and burst up to 768Mb is always using more than 512Mb.

Also read this howtos:
http://www.isp-control.net/documentation...ces_system
http://www.isp-control.net/documentation...erformance
(This post was last modified: 08-11-2009 12:34 PM by tuxStyle.)
08-11-2009 12:28 PM
Find all posts by this user Quote this message in a reply
Deadlineo3n Offline
Newbie
*

Posts: 8
Joined: May 2009
Reputation: 0
Post: #9
RE: Exsessive memory usage.
This topic does not exist yet

wow nice articles....
08-13-2009 01:12 AM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #10
RE: Exsessive memory usage.
Something is broken regarding dokuwiki and "pretty" urls, but it shouldn't have taken you too long to spot that he was referring to Documentation -> Howtos -> Miscellaneous -> Run ispcp on a low resources system.

Moreover, I think you should have searched before posting so would have found this howto alone.

Edit: sorry for being rude, but your attitude has really annoyed me.
(This post was last modified: 08-13-2009 04:35 AM by kilburn.)
08-13-2009 04:34 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)