Can you give us an idea of the graph's shape and approximate row counts?
Couple of immediate thoughts:
- Are you using a 2nd level cache?
- Have you monitored the SQL sent to the DB and verified
that your graph is being loaded with exactly one SQL batch?
I recollect seeing a post from somebody who had achieved a significant
speedup in entity instantiation when using the LINQ API, I don't know if
it's applicable to your selection nor do I remember the details I'm
afraid, but it could be worth googling for...
/Pete
From: [email protected] [mailto:[email protected]] On
Behalf Of Jonathan Crowe
Sent: 23 April 2013 02:21
To: [email protected]
Subject: [nhusers] Efficiently loading a large object graph in a
multi-threaded winforms application.
I have a winforms application written in C#/.Net 4.0 using nHibernate
3.3.3, Fluent 1.3, and SQLite 1.0.84.
I have been dealing with a requirement where a user chooses a particular
entity in our system and we must 1) open the record up for
viewing/editing, and 2) without blocking the UI, serialize the entity to
be sent to another system that we have to communicate with as changes
are made; I could get a little more detailed but that is the general
idea. I have on ISession dedicated to the UI (since lazy loading is
enabled) and another ISession for the background process. Whenever the
records are changed on the UI thread we must also update the external
process. Also, having a long delay before making the UI isn't really
acceptable; we might get by with 10seconds or so if needed.
The problem is that the entities I am dealing with are the parent to a
complex object graph with lots of data (lets just say the application
memory usage goes to roughly 750,000K+ when the whole record is loaded)
and it takes nHibernate a long time to fully loaded it (around 2-3
minutes without any optimizations). I have tried using .Future()
queries to reduce the number of database calls which has gotten the load
to 30-40 seconds, however there seems to be a point where the load time
starts increasing (because of too many queries executed in one go???).
I've also tried using some fetch join scenarios without out much gain.
I've spent quite a bit of time trying to come up with different
approaches and nothing seems to help. So I am looking to the nHibernate
community for some guidance. Have I hit the performance "wall" so to
speak, or are there other approaches that you can recommend?
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.