如何确保MySQL使用所有可用内存?

时间:2022-05-21 07:18:58

Dumb question: I have 4 gb of RAM and my dataset is around 500 mb. How can I make sure MySQL/InnoDB is keeping my dataset in RAM?

愚蠢的问题:我有4 GB的RAM,我的数据集大约是500 MB。如何确保MySQL / InnoDB将我的数据集保存在RAM中?

3 个解决方案

#1


6  

MySQL Tuning Primer gives you lots info and recommendations regarding your MySQL performance. Keep in mind (and it will warn you), the instance should be running for a period of time to give you accurate feedback.

MySQL Tuning Primer为您提供有关MySQL性能的大量信息和建议。请记住(它会警告你),实例应运行一段时间,以便为您提供准确的反馈。

#2


6  

set the innodb_buffer_pool to 3G - InnoDB will load as much data it can in the buffer pool.

将innodb_buffer_pool设置为3G - InnoDB将在缓冲池中加载尽可能多的数据。

#3


1  

Darhazer is right (I'd vote him up but don't have the rep points). It's generally recommended to set innodb_buffer_pool_size to 70-80% of memory although it's really more complicated than that since you need to account for how much RAM other parts of your system is actually using.

Darhazer是对的(我会投票给他,但没有重复点)。通常建议将innodb_buffer_pool_size设置为70-80%的内存,尽管它确实比这更复杂,因为您需要考虑系统其他部分实际使用的RAM量。

#1


6  

MySQL Tuning Primer gives you lots info and recommendations regarding your MySQL performance. Keep in mind (and it will warn you), the instance should be running for a period of time to give you accurate feedback.

MySQL Tuning Primer为您提供有关MySQL性能的大量信息和建议。请记住(它会警告你),实例应运行一段时间,以便为您提供准确的反馈。

#2


6  

set the innodb_buffer_pool to 3G - InnoDB will load as much data it can in the buffer pool.

将innodb_buffer_pool设置为3G - InnoDB将在缓冲池中加载尽可能多的数据。

#3


1  

Darhazer is right (I'd vote him up but don't have the rep points). It's generally recommended to set innodb_buffer_pool_size to 70-80% of memory although it's really more complicated than that since you need to account for how much RAM other parts of your system is actually using.

Darhazer是对的(我会投票给他,但没有重复点)。通常建议将innodb_buffer_pool_size设置为70-80%的内存,尽管它确实比这更复杂,因为您需要考虑系统其他部分实际使用的RAM量。