views:

83

answers:

2

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. How should I do this?

+3  A: 

One possible solution would be to run the app and MySQL in a virtualized environment. You can generally control the RAM and number of CPUs to see how it would perform.

Check out http://www.virtualbox.org , it's the best one I've used and it's free.

Topher Fangio
It doesn't even matter if your virtualization environment supports that, since Linux does: see the mem= and maxcpus= boot arguments.
Ken
@Ken - Good point. I don't run in Linux most of the time, so I forget these things :-)
Topher Fangio
+3  A: 

If you're on a linux system, you can take advantage of 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.

zombat
I am going to test this with a program(c) I wrote. I want to test if program will exit gracefully when out of memory.
Alfred