By putting this on your mysql config file:
innodb_buffer_pool_size = 2G
In dedicated db machines, you can set this to close to 80% of the available memory. This will avoid disk writes and speed up things in general.
The mysql configuration file is on :
Restaring mysql, and barabum barabim
The typical error message you get when this is too small is:
Mysql::Error: The total number of locks exceeds the lock table size: