Posted by ajayg on April 18, 2011 at 4:36am
I have a separate server for Mysql. I am noticing that the amount of used memory shown by Top is gradually increasing.
I don't have anything else on the server (no php) except for basic OS (fedora 13)
Some tables are myisam and some are innoDB. Used drupal 6.x so started originally with myisam and converted a few to innodb as required.
I know mysql is memory hog. But is this normal? Is there a way to tail MYSQL to have a limit?
Quite popular site so is this a result of number of connecttion? But then shouldn't it release the memory as time goes?
Anybody else seen this? using mysql 5.1.48
Comments
http://www.day32.com/MySQL/tu
http://www.day32.com/MySQL/tuning-primer.sh
This might shed some light on your MySQL-setup, when it comes to InnoDB it's usually more of a memory hog than myisam, but on a high memory system, it should not make a huge difference. What are your system stats? And yes, you can limit MySQL max memory limit, but you generally want it to be able to eat as much memory as possible, or else things will slow down. MySQL is usually a bottleneck.
Are your users authenticated or anonymous? In case of the latter, have you considered reverse caching proxies, like Varnish?
--
Vegard
Normal
This is almost certainly normal. In general, having your DB use a lot of memory is good: it is buffering frequently used data so that it doesn't need to touch the disk, which is an enormous win in terms of performance.
Linux process don't "release their memory" as time goes unless there's something else that needs them, so there's absolutely nothing wrong with what you're seeing.
You can tune the settings in my.cnf -- partcularly your buffer limits -- if you're concerned about memory utilization. However, if this box is dedicated to mysql, you should be tuning for 80 to 90% consistent memory utilization.
https://pantheon.io | http://www.chapterthree.com | https://www.outlandishjosh.com
Is sawpping normal? I see
Is sawpping normal?
I see that eventually it runs out of memory and TOP shows that it is swapping. That can't be good.
I can see 80-90% memory utilization is good but how to stop at 90%?
I am already using tunig_primer.sh and according to it I should have plenty of memory left. But eventually that is getting exhauseted.
do the math
You're going to have to do the math and not over-allocate resources.
Take a look at the values inside your mysql configuration and be sure you're not specifying more memory than is available.
https://pantheon.io | http://www.chapterthree.com | https://www.outlandishjosh.com
I think you're over-worrying this
Yes, eventually after you're up for a while the OS (I have to assume some flavor of Linux -- you don't say what you're running) will start swapping out processes that you're not using in an attempt to make more memory for what you ARE using, and to generate more space for caching. Unless you're actually seeing performance issues, and your system is paging heavily, I wouldn't worry about it.
OS memory tuning isn't something that's simple, and you're talking about a bunch of different things here. Some actual numbers would be helpful. and vmstat is your friend.
Steve Hanson
Cruiskeen Consulting LLC - http://www.cruiskeenconsulting.com
The problem with these tuning
The problem with these tuning scripts is that they don't know when to tell you to stop increasing. Thus pushing your server into swap. You've also got to have a good understanding of each parameter before you change it. I would recommend not changing a parameter to more than 4x the default unless you really know what you are doing (With the exclusion of some very important ones like innodb_buffer_pool_size and innodb_log_file_size or key_buffer_size).
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
Here's a very interesting, if
Here's a very interesting, if rather technical, post by the creator of Varnish on this whole concept of applications trying to manage their own memory, like MySQL does. Won't be immediately helpful for your problem, but it may be food for thought.
The Boise Drupal Guy!