简体   繁体   English

您如何使用MySQL模拟内存不足?

[英]How do you simulate memory shortage with MySQL?

I want to know how my system behaves under a high load. 我想知道我的系统在高负载下的行为。 To do so I would like to artificially reduce the amount of memory available to MySQL. 为此,我想人为地减少可用于MySQL的内存量。 How should I do this? 我应该怎么做?

If you're on a linux system, you can take advantage of ulimit . 如果您使用的是Linux系统,则可以利用ulimit Given that a shell uses very little memory, you could open a shell and run: 考虑到外壳使用的内存很少,您可以打开外壳并运行:

ulimit -m <memory size>

to limit the memory for that shell, and then start your MySQL server there. 限制该外壳程序的内存,然后在此处启动MySQL服务器。

One possible solution would be to run the app and MySQL in a virtualized environment. 一种可能的解决方案是在虚拟环境中运行应用程序和MySQL。 You can generally control the RAM and number of CPUs to see how it would perform. 通常,您可以控制RAM和CPU数量以查看其性能。

Check out http://www.virtualbox.org , it's the best one I've used and it's free. 查看http://www.virtualbox.org ,这是我用过的最好的免费的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM