- Enable 2nd level cache and have a strategy for using it for some of your classes. reference
- Enable batch processing for persistence of objects. This will allow NHibernate to send batches of your transactions (Inserts, Updates and Deletes) to the server in a batch. reference
- Have a good strategy for flushing and transaction management. Remember that if you commit a transaction that you do not need to flush the object. reference
- Make read-only classes immutable. reference
- Understand lazy loading and use effectively, for instance when you may but not always need an associated object(s) reference
- To bypass lazy loading understand eager fetching and use when you know you need associated object(s) and want to bypass lazy loading. reference
- Remove any columns and properties that you will never or should never need or use.
- Using value type objects for your properties and components as opposed to reference types, when you have a choice, this will lower memory footprint.
- Avoid composite keys (exception legacy databases). Composite keys are problematic for database design as well as OR/M therefore avoid them. reference
- Consider your logging strategy for production (less verbose) and usually disable show_sql in production.
Orin's NHib Profiler can also help you find improvements you can make to your configuration of NHibernate.
No comments:
Post a Comment