The cost of eager load...
This is the profiler results from trying to understand why I got very slow responses from the server...
Notice what is costing so much time here. The first issue was that
the system was generated huge amounts of queries, and the quick & dirty
solution was to throw caching on top of this, which had a difference of three to
five orders of magnitude. The image above is after applying the caching, by the way, and there is no database activity in this call graph.
But performance continue to suffer, and I wasn't quite sure why. A quick look at the profiler and then at the mapping showed the reason quite clearly. In this case, the issue is a God Class (you know those, the one that is connected to all the entities in the database) that has no lazy collections.
As a result of this, per request, NHibernate had to construct the entire database in memory. Often just because the developer wanted to display a single (simple) property from the God Class.
When I removed the access to this class, I got about 10x performance boost...
Comments
Comment preview