<property name="hibernate.generate_statistics" value="true"/>
In a production scenario, it would make sense to switch the above flag to false. What other flags should be modified so that hibernate engine is optimized for a faster speed accessing a MySQL database.
It depends :) you can set cache sizes, fetch depth (for outer joins), fetch batch sizes and many more things.
You probably don't want to log too much (show_sql => set to false, format_sql => set to false, use_sql_comments => set to false).
But really, it depends and you have to measure.
It is also important to use and properly configure a connection pool. Here again: Use common sense and measure.
Hopefully, these links will prove to be useful:
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html
The crucial point is to get the model right. Performance will be an issue if many sql requests are generated that do massive joins. So if performance is critical, you have to spend some thinking on normalization or in fact on NOT doing too much normalization in your entity-relationship modelling.
Also, collections and how you model/handle them can play a big role in terms of performance.
And as far as caching is concerned: Depending on your use case, you can improve performance by great lengths if you configure your second level cache (e.g. Ehcache) properly. That again means: Think about what can be cached and what not and how long-lived and how large your caches can and should be. So it really, reallly depends :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With