Print Page | Close Window

Entity Manager Queuing

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2082
Printed Date: 30-Apr-2025 at 6:15pm


Topic: Entity Manager Queuing
Posted By: *Calsy
Subject: Entity Manager Queuing
Date Posted: 22-Aug-2010 at 1:50pm
Hi All, Two questions:
 
1. If multiple queries are called to one entity manager at the same time how does the entity manager queue them up? For instance if 5 queries are called at the same time in what order will they be executed? Will the entity manager only ever execute them sequentially or at the same time?
 
2. If I have multiple sets of data to pull at the same time, is it more advantageous to create multiple entity managers and send each data call through a different manager?
 
All these data calls are being fired from different controls in the application so creating parallel tasks isnt really possible.
 
Thanks in advance



Replies:
Posted By: kimj
Date Posted: 23-Aug-2010 at 11:41am
1) Asynchronous queries are "issued" in the order that you've called them, but their completion (and subsequent processing) is dependent on when the queries complete.  Each async query is processed on a separate worker thread, and the EntityManager does track all outstanding async requests but doesn't actually queue them.  As async requests complete back on the main calling thread they will be processed in the order they've completed. 
 
2) In terms of the pipeline between client and server, there's really no difference between one EntityManager issuing many async requests vs. many EntityManagers each issuing one request.   If each EM is connected to the same EntityServer then they will all use a common communication proxy.   It's therefore application dependent how you handle this - it may be cleaner, or even more performant, to use separate EMs to load data and then import into a central EM, but it would really depend on your specific needs and require some performance testing.  Remember that an EM is not threadsafe, and can only be safely used by one thread at a time.



Print Page | Close Window