0

I have an application (MongoDB + Hibernate OGM) that contains some features. I would like to measure the performance of the persistence technology for certain operations (search, adding, deleting etc.) for those particular features.

Because I am measuring the performance of those features, I would think the best way would be to measure operations inside the application and not outside from it. I am not quite sure whether this approach is correct.

For instance, what I do now is:

long startTime = System.currentTimeMillis();
personDao.persist(persons.get(i));
long endTime = System.currentTimeMillis() - startTime;
System.out.println("End:" + endTime);

However, is it fair to measure it like this? Does someone have any tips to measure the performance of the persistence technology? Based on this, I would like to compare it with other persistence technology (such as MySQL + Hibernate ORM or another NoSQL technology like Cassandra).

Community
  • 1
  • 1
user3125591
  • 113
  • 5
  • 13

1 Answers1

1

Check out this answer to learn more about writing micro benchmarks in Java. Then I recommend to take a look at JMH for writing benchmarks.

Gunnar
  • 18,095
  • 1
  • 53
  • 73
  • Amazing! You're the same guy who helped me at the Hibernate OGM Forum. Thank you for the help man keep up the good work! – user3125591 Feb 25 '15 at 20:30