Mysql using lots of Virtual Memory

Our MySQL has been running slow as of late.  We're running the default version that comes with OS X Server 10.3.9.  We have about 30 clients submitting a query about every second (total).

When I look at the Activity Monitor I see that mysqld is using 8 Megs of Real Memory and 500 to 600 Megs of Vritual memory.  Does this mean that most of MySQL's memory is on the hard disk and performing slowly?  Should it be listed in Real memory?  I see that the activity monitor says I only have 14megs of system memory free.

The server has 1 Gb of memory, and is running as a busy file server, domain manager and MySQL server.  Would adding memory make a difference to Mysql?

Thanks in advance,

masterwoodsman
KayjonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

njxbeanCommented:
A program accesses virtual memory when there is not enough "Real" memory.  I would add another GB.  i think you will see a great improvement.
0
hfernCommented:
Database tuning is a complex matter. Adding memory may help, but there could also be other reasons why MySql uses so much memory. To start off, let me ask some questions:
1. The 30 queries by 30 users, are they all reads (ie select queries) or are there also writes (updates or inserts)? MySql does table locking for writes. This means that the write will only commence once the table can be locked and that during the write, all reads and other writes are queued until the lock is released. This can cause delays and more memory consumption. Adding memory will not help if this is the cause of your problem.
2. What type of tables are you using? Are thay all disk based tables or do you also use memory mapped tables? Compressed ISAM tables can be expanded in memory. Obviously memory mapped tables will use memory. If the system does not have enough real memory then indeed it will use vritual memory and you will see memory swapping occurring.
3. Are your queries using a lot of Joins? They are also mostly performed in memory.

While researching this, I also found that memory usage of mySql is not always reported correctly. See the folloing bit from the MySql manual:
"`ps' and other system status programs may report that `mysqld' uses a lot of memory. This may be caused by thread stacks on different memory addresses.  For example, the Solaris version of `ps' counts the unused memory between stacks as used memory."

You can read more on MySql memory usage by opening a terminal window and type "info mysqld". Memory usage for the mySql server is described in chapter 7.5: Optimizing the MySql Server.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James LooneySr. Programmer/AnalystCommented:
I have 2Gb of RAM in my XServe, when I see the Free RAM showing up as real low, I run the periodic scripts - and that always helps - as it frees up memory being used to keep big log files open. So try that.

Open Terminal and type this in:

periodic daily weekly monthly

then hit Return.

It'll take a little while to run, but it should help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apple OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.