Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a 8-core MySQL server with 32 GB of RAM, holding 40 MyISAM tables (total: ~4GB of data). Since the databases size is several times smaller than the available memory, how can I make full usage of my server's resources?

  1. What settings should I attempt configure in my.cnf?

  2. Can I force data + indexes to stay in memory?

share|improve this question
    
What version of mysql are you using ??? –  RolandoMySQLDBA Mar 12 '12 at 15:02
    
mysql Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64) using readline 6.1 –  Vlad Zloteanu Mar 12 '12 at 15:12

2 Answers 2

up vote 4 down vote accepted

MySQL only caches the indexes in MySQL's memory, not the data. The data is only cached by the underlying operating system's filesystem caches. The most important value to tune in my.cnf is key_buffer_size which will allocate memory for MyISAM to cache indexes.

However, unless you have some specific reason for using MyISAM tables you should convert those tables to InnoDB. In this day and age, there are less than a handful of reasons to use use MyISAM and MyISAM is not good for concurrency, data integrity, or crash recovery.

If you switch to InnoDB, the most important setting is innodb_buffer_pool_size which is the internal memory cache that will cache data pages & indexes. Other things to consider are the innodb_log_file_size and make sure to set innodb_file_per_table=1. With 4GB of data+indexes, setting innodb_buffer_pool_size=4G is reasonable. If you are running in a highly concurrent environment, you could experiment with values for innodb_thread_concurrency. My recommendation is to start with innodb_thread_concurrency=0, but you might find it necessary to explicitly set it to be somewhere between 4-8 depending on your workload and version of MySQL.

share|improve this answer

I agree with Aaron (+1) in that you should use InnoDB because you cannot cache data for MyISAM.

Here are the settings you should be concerned with

My Recommedation

You should upgrade to MySQL 5.5 because there are new settings to engage multiple cores by means of increased hyperthreading. The options exist in MySQL 5.1 starting with 5.1.38 but only in the InnoDB Plugin. It is simpler and more practical to upgrade to 5.5 rather than attempting to wedge in the InnoDB Plugin.

share|improve this answer
    
+1 for providing the links to documentation :) –  Aaron Brown Mar 13 '12 at 17:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.