Resetting any state between runs

We saw, in the previous section, that you must prepare as much data as the production database will work with, but also don't forget to reset the database state between each run.

If you don't do it, the risk is you will slow down the execution between each run and make the optimizations you do completely invisible. This is because databases have a sort of size limit (quite huge), but while you benchmark, you will generally insert a lot of data very quickly so it wouldn't be surprising to reach that limit. Once you reach this size limit, the database is less efficient and performance degrades. To ensure you can compare the runs and validate some tuning options, you must run in the same conditions. So, you should ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.