6

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?

2
  • What version of mysql are you using ??? Commented Mar 12, 2012 at 15:02
  • mysql Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64) using readline 6.1 Commented Mar 12, 2012 at 15:12

2 Answers 2

6

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.

1
  • i just tried convert myisam table to innodb and speed is 4x bigger than with myisam. so that looks like a specific reason to stay with it.
    – luky
    Commented Jun 22, 2021 at 16:01
5

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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