It is important to provide enough memory space for the MySQL database to cache data and indexes:
Edit the Tomcat configuration file:
/etc/my.cnf
Insert the following line in the [mysqld] section, below the datadir line. Use a value that is appropriate for your situation. We recommend setting the buffer pool at 40% of RAM if MySQL is on the same server as the management server or 70% of RAM if MySQL has a dedicated server. The following example assumes a dedicated server with 1024M of RAM.
innodb_buffer_pool_size=700M
Restart the MySQL service.
# service mysqld restart
For more information about the buffer pool, see "The InnoDB Buffer Pool" at MySQL Reference Manual.