ispCP - Board - Support
Exsessive memory usage. - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: Usage (/forum-34.html)
+--- Thread: Exsessive memory usage. (/thread-7207.html)

Pages: 1 2


Exsessive memory usage. - bigbob85 - 07-12-2009 05:42 PM

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.


RE: Exsessive memory usage. - jim.thornton - 08-03-2009 04:56 AM

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?


RE: Exsessive memory usage. - joximu - 08-03-2009 06:11 AM

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


RE: Exsessive memory usage. - MasterTH - 08-03-2009 02:26 PM

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.


RE: Exsessive memory usage. - kilburn - 08-04-2009 06:56 AM

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...


RE: Exsessive memory usage. - jim.thornton - 08-04-2009 08:03 AM

How do you limit mysql cache? And what should it be limited to?


RE: Exsessive memory usage. - kilburn - 08-04-2009 03:57 PM

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.


RE: Exsessive memory usage. - tuxStyle - 08-11-2009 12:28 PM

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/howto/miscellaneous/run_ispcp_on_a_low_resources_system
http://www.isp-control.net/documentation/howto/miscellaneous/mysql_performance


RE: Exsessive memory usage. - Deadlineo3n - 08-13-2009 01:12 AM

This topic does not exist yet

wow nice articles....


RE: Exsessive memory usage. - kilburn - 08-13-2009 04:34 AM

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.