Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimizing an ORM-based model post-launch

I'm using Hibernate to work on a new project, and as I work I'm realizing that my original vision for the application may not end up being its destiny. Data that I think is not going to be often requested (and thus lazy-loaded) might end up being needed for 85% of requests. Conversely, data that I'm loading under the assumption it will be needed might turn out to not be needed as often as I think it will.

Is there some profiling tool or method of analyzing ORM usage (specifically: Hibernate) that can help me tune my application after it has reached critical mass?

The only thing that comes to mind is to write some Selenium scripts that mimic actual usage and do load testing with different configurations. That seems like it might work but also feels like a very round-about way of getting the information I'm after. There has to be a better way...

like image 851
Adam Tuttle Avatar asked Feb 05 '10 15:02

Adam Tuttle


2 Answers

Is there some profiling tool or method of analyzing ORM usage (specifically: Hibernate) that can help me tune my application after it has reached critical mass?

Hibernate 3 gather statistics at run-time. Might be worth having a look. There is a section "Monitoring performance" in the hibernate doc.

The only thing that comes to mind is to write some Selenium scripts that mimic actual usage and do load testing with configurations. That seems like it might work but also feels like a very round-about way of getting the information I'm after.

You should try first to capture some real workload. Then figure out how to reproduce it.

Otherwise you will still be biased and may generate a load that actually doesn't represent the reality anyway. If you can't capture a real workload, then discuss with potential end-user to see how they use the app and make sure your scenario are as close as possible to the real end-user behavior.

like image 126
ewernli Avatar answered Oct 11 '22 19:10

ewernli


"...help me tune my application after it has reached critical mass?"

This is important.

You're tuning your application -- as a whole. App + data base structure + Hibernate ORM mappings + anything else.

Your application should have logs that you can use for tuning your application. If you don't have suitable logging, now is the time to add an appropriate set of logs to determine which use cases are being used and what's happening.

Tuning logs are as important as debugging logs. And they're a first-class part of your application.

like image 29
S.Lott Avatar answered Oct 11 '22 17:10

S.Lott