<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Performance Question</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Performance Question</description>
  <pubDate>Tue, 28 Apr 2026 19:42:05 -700</pubDate>
  <lastBuildDate>Thu, 08 Oct 2009 08:21:47 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=1499</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Performance Question : &amp;#034;I finished my nap.&amp;#034;...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5598#5598</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 08-Oct-2009 at 8:21am<br /><br />"I finished my nap." - Gune, Titan AE.<br /><br />I worked up the code for the EntityCacheState and the tests are coming in at 6-8s load time for the 18 queries.  <br /><br />So far, this is the best option for priming the cache, but the main query to load the list view itself is still slow.  I look forward to finding out what you guys figure out.<br /><br />Here's the code that loads the cache state in an Async method:<br /><br /><font face="Courier New, Courier, mono">//In the Module project, called from ViewModel.Start()<br />internal class ViewModelEntityInitializer<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public ViewModelEntityInitializer(ListViewModel viewModel)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.ViewModel = viewModel;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void RunInitializationQueries(Action completedAction)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.CompletedAction = completedAction;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var ds = new DomainModelLoaderService();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ds.LoadModuleCompleted += new EventHandler(ds_LoadModuleCompleted);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ds.PreLoadModuleAsync();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void ds_LoadModuleCompleted(object sender, EventArgs e)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProcessActiveBusAssociates();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProcessZones();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.CompletedAction.Invoke();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private ListViewModel ViewModel { get; set; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private Action CompletedAction { get; set; }<br />}<br /><br />//In the DomainModel and ClientModel projects<br />public class DomainModelLoaderService<br />{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void PreLoadModuleAsync()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var manager = LocalEntityManager.DefaultManager;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ServerMethodDelegate myDelegate = new ServerMethodDelegate(PreLoadModule);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;manager.InvokeServerMethodAsync(myDelegate, PreLoadModuleAsyncCallback, null);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void PreLoadModuleAsyncCallback(InvokeServerMethodEventArgs args)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var manager = LocalEntityManager.DefaultManager;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//restore entitycachestate<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EntityCacheState cache = (EntityCacheState)args.Result;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cache.Merge(manager, RestoreStrategy.Normal);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OnLoadModuleCompleted(EventArgs.Empty);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public event EventHandler LoadModuleCompleted;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void OnLoadModuleCompleted(EventArgs e)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (LoadModuleCompleted != null)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LoadModuleCompleted(this, e);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#091;AllowRpc&#093;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public static EntityCacheState PreLoadModule(IPrincipal principal, EntityManager em, params object&#091;&#093; args)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var manager = LocalEntityManager.DefaultManager;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var task = AsyncParallelTask.Create();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;task.AddAsyncQuery("BusAssociates", x =&gt; manager.BusAssociates, null);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;task.AddAsyncQuery("Zones", x =&gt; manager.Zones, null);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_trigger = new AutoResetEvent(false);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;task.Execute(PreLoadModuleCompleted);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_trigger.WaitOne();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return manager.CacheStateManager.GetCacheState();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static AutoResetEvent _trigger;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public static void PreLoadModuleCompleted(AsyncParallelTaskCompletedArgs args)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_trigger.Set();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />}</font><br /><br />(My thanks to blog: http://jasondotnet.spaces.live.com/blog/cns!BD40DBF53845E64F!170.entry for how the AutoResetEvent is used.)]]>
   </description>
   <pubDate>Thu, 08 Oct 2009 08:21:47 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5598#5598</guid>
  </item> 
  <item>
   <title>Performance Question : I understand.  Meanwhile, I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5584#5584</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 06-Oct-2009 at 8:56am<br /><br />I understand.<DIV>&nbsp;</DIV><DIV>Meanwhile, I keep trying to think of workarounds ... the EntityCacheState will serialize to the SL client correctly in v5.2.3 coming Oct. 15, so grabbing all this data via an invoked server method which does the AsyncParallelTask and returns an EntityCacheState could be another option.&nbsp; PM&nbsp;or email me if this is something you'd want to try now.</DIV>]]>
   </description>
   <pubDate>Tue, 06 Oct 2009 08:56:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5584#5584</guid>
  </item> 
  <item>
   <title>Performance Question : Thank you for looking in to this....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5583#5583</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 06-Oct-2009 at 6:28am<br /><br />Thank you for looking in to this.  Performance is DEFINITELY our highest priority.  The server-side performance is quite acceptable.  One of the configurations runs all the queries in a total of less than 4 seconds.  I think there's a configuration that actually loads them in less than 1 second, but I'm not sure off the top of my head.  Anyway, when that 4 seconds becomes 30 - 160 seconds to load the same data to the client, that's where we have to find a way to improve the performance significantly.  <br />Thanks, Simon.]]>
   </description>
   <pubDate>Tue, 06 Oct 2009 06:28:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5583#5583</guid>
  </item> 
  <item>
   <title>Performance Question : Just an update to let you know...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5579#5579</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 05-Oct-2009 at 2:08pm<br /><br />Just an update to let you know we're still looking at this.&nbsp; The problem is Silverlight-specific, and likely due to the number of threads started or to possible limitations with WCF in Silverlight.&nbsp; We'll keep you updated.&nbsp; <DIV>&nbsp;</DIV><DIV>As for a workaround for you right now, I don't know what to tell you.&nbsp; Presumably the AsyncSerialTask will be faster, but at about 30 seconds probably still too slow.&nbsp; You might be able to use .Include with <EM>some</EM> of your queries.&nbsp; I know you'd tried a giant .Include query with poor performance, but maybe "judicious" use of .Include which keeps the SQL queries from getting too ugly might be a compromise.</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Mon, 05 Oct 2009 14:08:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5579#5579</guid>
  </item> 
  <item>
   <title>Performance Question : Right.   That&amp;#039;s what I think...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5572#5572</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 12:03pm<br /><br />Right.  <br />That's what I think too.<br /><br />As an aside, what am I looking for in Fiddler?  I have the Firefox/Fiddler solution working.  Thanks for the link.  There's a ton of activity when I run the tests and there are some big chunks of message coming back, but all of the items have a TotalElapsedTime that is a fraction of a second.]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 12:03:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5572#5572</guid>
  </item> 
  <item>
   <title>Performance Question : Okay. So where are we now? I think...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5570#5570</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 11:54am<br /><br />Okay.&nbsp; So where are we now?&nbsp; I think you've got these timings ... (?)<DIV>&nbsp;</DIV><DIV>AsyncParallelTask (with 18 queries) in SL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 60 seconds<BR>daisy chained 18 queries in SL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 30 seconds<BR>18 async queries in SL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 160 seconds<BR>AsyncParallelTask (with 18 queries) on server = under 1 second<BR></DIV><DIV>&nbsp;</DIV><DIV>I also want to test the AsyncParallelTask with a BOS in non-SL to get an idea of what the transmission hit is between a BOS and no-BOS run.&nbsp; I can do this later today in our test suite.&nbsp; Right now I think it's still unclear what is transmission-related overhead, what is SL-related, and what is AsyncParallelTask-related.</DIV>]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 11:54:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5570#5570</guid>
  </item> 
  <item>
   <title>Performance Question : Here&amp;#039;s the Daisy Chain version...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5569#5569</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 11:26am<br /><br />Here's the Daisy Chain version of the test running client side in a Silverlight Unit Test.  This one calls em.ExecuteQueryAsync on each of the queries and then calls the next query in that ones callback.  Total time is 30 seconds.  <br /><br /><font face="Courier New, Courier, mono">&#091;TestClass&#093;<br />public class DealQueriesSerial : SilverlightTest<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;DomainModelEntityManager _em = new DomainModelEntityManager();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&#091;TestMethod&#093;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#091;Asynchronous&#093;<br />&nbsp;&nbsp;&nbsp;&nbsp;public void TestAQueryPerf()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _em.InitializeEntityManagerCompleted += new EventHandler(TestAQueryPerf_em_InitializeEntityManagerCompleted);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; _em.InitializeEntityManager());<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;private void TestAQueryPerf_em_InitializeEntityManagerCompleted(object sender, EventArgs e)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; Logging.TimerStart());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; _em.ExecuteQueryAsync(_em.BusAssociates, TestAQueryPerf_QueryCallback01, null));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;private void TestAQueryPerf_QueryCallback01(EntityFetchedEventArgs args)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; _em.ExecuteQueryAsync(_em.Contacts, TestAQueryPerf_QueryCallback02, null));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;...<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;private void TestAQueryPerf_QueryCallback18(EntityFetchedEventArgs args)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueTestComplete();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var elapsedTime = Math.Round(Logging.TimerStop() / 1000, 2);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double target = 1; //seconds<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsTrue(elapsedTime &lt; target, String.Format("Query Initialization took {0}s, it should be less than {1}s", elapsedTime, target));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</font><br /><br />I also tried a parallel run by just calling ExecuteAsync on all the queries in one method.  This killed the performance and takes over 160 seconds to run. Yeuch.<br /><br /><font face="Courier New, Courier, mono">&#091;TestClass&#093;<br />public class DealQueriesParallel : SilverlightTest<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;DomainModelEntityManager _em = new DomainModelEntityManager();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&#091;TestMethod&#093;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#091;Asynchronous&#093;<br />&nbsp;&nbsp;&nbsp;&nbsp;public void TestAQueryPerf()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _em.InitializeEntityManagerCompleted += new EventHandler(TestAQueryPerf_em_InitializeEntityManagerCompleted);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; _em.InitializeEntityManager());<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;private void TestAQueryPerf_em_InitializeEntityManagerCompleted(object sender, EventArgs e)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; Logging.TimerStart());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; _em.ExecuteQueryAsync(_em.BusAssociates, TestAQueryPerf_QueryCallback, null));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnqueueCallback(() =&gt; _em.ExecuteQueryAsync(_em.Zones, TestAQueryPerf_QueryCallback, null));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;private int TestAQueryPerf_QueryCallback_Counter = 0;<br />&nbsp;&nbsp;&nbsp;&nbsp;private void TestAQueryPerf_QueryCallback(EntityFetchedEventArgs args)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TestAQueryPerf_QueryCallback_Counter++;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (TestAQueryPerf_QueryCallback_Counter == 19)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EnqueueTestComplete();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var elapsedTime = Math.Round(Logging.TimerStop() / 1000, 2);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double target = 1; //seconds<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(elapsedTime &lt; target, String.Format("Query Initialization took {0}s, it should be less than {1}s", elapsedTime, target));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</font>]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 11:26:48 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5569#5569</guid>
  </item> 
  <item>
   <title>Performance Question : A Count() clause causesimmediate...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5567#5567</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 10:23am<br /><br />A Count() clause causes&nbsp;immediate execution of the query -- it's a LINQ thing more than a DevForce thing.&nbsp; To retrieve data you can use ToList() (or ToArray()) to force execution, or enumerate the query with a for/each.&nbsp;&nbsp; EF also lets you call Execute on the query, and DevForce has all its variations on Execute or ExecuteQuery.&nbsp; I always recommend that developers read up on deferred vs. immediate execution in LINQ, since&nbsp;it's not really intuitive and the cause of lots of problems.&nbsp;]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 10:23:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5567#5567</guid>
  </item> 
  <item>
   <title>Performance Question : I did not realize that.  I have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5565#5565</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 10:05am<br /><br />I did not realize that.  I have changed it to do this:<br /><br /><font face="Courier New, Courier, mono">&#091;TestMethod&#093;<br />public void InitializationQueries()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;ServerModelEF.ModelEntities em = new ModelEntities();<br />&nbsp;&nbsp;&nbsp;&nbsp;var timerStart = DateTime.Now;<br />&nbsp;&nbsp;&nbsp;&nbsp;var items01 = from item in em.BusAssociates select item;<br />&nbsp;&nbsp;&nbsp;&nbsp;ScanAll(items01);<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;var items19 = from item in em.Zones select item;<br />&nbsp;&nbsp;&nbsp;&nbsp;ScanAll(items19);<br />&nbsp;&nbsp;&nbsp;&nbsp;var elapsedTime = Math.Round(DateTime.Now.Subtract(timerStart).TotalMilliseconds / 1000, 2);<br />&nbsp;&nbsp;&nbsp;&nbsp;double target = 1; //seconds<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(elapsedTime &lt; target, String.Format("Query Initialization took {0}s, it should be less than {1}s", elapsedTime, target));<br />}<br /><br />private void ScanAll(IQueryable qry)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach (var item in qry)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //do nothing<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</font><br /><br />That should retrieve all the items, shouldn't it?<br />That brought the timing of the ServerModelEF test up from 1s to 2.3s.]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 10:05:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5565#5565</guid>
  </item> 
  <item>
   <title>Performance Question : Something I just noticed which...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5564#5564</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 9:10am<br /><br />Something I just noticed which isn't really pertinent to the problem but which may skew the timings, is that in your tests not using the AsyncParallelTask you're not actually retrieving any data, you're just retrieving a count -- <DIV>&nbsp;</DIV><DIV>&nbsp; &nbsp;&nbsp;var items01 = from item in em.BusAssociates select item; <BR>&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(items01.Count() &gt; 0); <BR></DIV><DIV>&nbsp;</DIV><DIV>.. this selects only the number of items, it doesn't retrieve the items and then do a count.&nbsp; DevForce handles the retrieval of a primitive much differently than the retrieval of entities which need to be merged into cache.&nbsp; When going over the wire too there's of course a big difference in message size.</DIV><DIV>&nbsp;</DIV><DIV>I didn't know you were working with the development web server,&nbsp;in that case, I use Firefox and Firebug (which may require Fiddler too I'm not sure, but integrates really well with it).&nbsp; Ward blogged about how to set up Firefox and Fiddler - <a href="http://neverindoubtnet.blogspot.com/2009_08_01_archive.html" target="_blank">http://neverindoubtnet.blogspot.com/2009_08_01_archive.html</A>.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 09:10:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5564#5564</guid>
  </item> 
  <item>
   <title>Performance Question : This is interesting.  Using the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5561#5561</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 6:55am<br /><br />This is interesting.  Using the AsyncParallelTask in the DomainModel project (Server side only) sped up the load from 1.04s to 0.84s.  Nice.  Here's the test:<br /><br /><font face="Courier New, Courier, mono">&#091;TestMethod&#093;<br />public void InitializationQueriesAsync()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;var em = new DomainModelEntityManager();<br />&nbsp;&nbsp;&nbsp;&nbsp;em.InitializeEntityManager();<br />&nbsp;&nbsp;&nbsp;&nbsp;var timerStart = DateTime.Now;<br />&nbsp;&nbsp;&nbsp;&nbsp;var task = AsyncParallelTask.Create();<br />&nbsp;&nbsp;&nbsp;&nbsp;task.AddAsyncQuery("BusAssociates", x =&gt; em.BusAssociates, null);<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;task.AddAsyncQuery("Zones", x =&gt; em.Zones, null);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;//See blog: http://jasondotnet.spaces.live.com/blog/cns!BD40DBF53845E64F!170.entry<br />&nbsp;&nbsp;&nbsp;&nbsp;//for how the AutoResetEvent is used<br />&nbsp;&nbsp;&nbsp;&nbsp;this._TestTrigger = new AutoResetEvent(false);<br />&nbsp;&nbsp;&nbsp;&nbsp;task.Execute(InitCompleted);<br />&nbsp;&nbsp;&nbsp;&nbsp;this._TestTrigger.WaitOne();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;var elapsedTime = Math.Round(DateTime.Now.Subtract(timerStart).TotalMilliseconds / 1000, 2);<br />&nbsp;&nbsp;&nbsp;&nbsp;double target = 1; //seconds<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(elapsedTime &lt; target, String.Format("Query Initialization took {0}s, it should be less than {1}s", elapsedTime, target));<br />}<br /><br />AutoResetEvent _TestTrigger;<br /><br />public void InitCompleted(AsyncParallelTaskCompletedArgs args) {<br />&nbsp;&nbsp;&nbsp;&nbsp;this._TestTrigger.Set(); <br />}</font><span style="font-size:10px"><br /><br />Edited by skingaby - 02-Oct-2009 at 7:02am</span>]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 06:55:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5561#5561</guid>
  </item> 
  <item>
   <title>Performance Question : Sorry, I should have left more...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5560#5560</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 02-Oct-2009 at 6:37am<br /><br />Sorry, I should have left more of the code in test 3.  It used the exact code found in test 2.  No AsyncParallelTask:<br /><br /><font face="Courier New, Courier, mono">&#091;TestMethod&#093;<br />public void InitializationQueries()<br />{ <br />&nbsp;&nbsp;&nbsp;&nbsp;var em = new DomainModelEntityManager();<br />&nbsp;&nbsp;&nbsp;&nbsp;em.InitializeEntityManager();<br />&nbsp;&nbsp;&nbsp;&nbsp;var timerStart = DateTime.Now;<br />&nbsp;&nbsp;&nbsp;&nbsp;var items01 = from item in em.BusAssociates select item;<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(items01.Count() &gt; 0);<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;var items19 = from item in em.Zones select item;<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(items19.Count() &gt; 0);<br />&nbsp;&nbsp;&nbsp;&nbsp;var elapsedTime = Math.Round(DateTime.Now.Subtract(timerStart).TotalMilliseconds / 1000, 2);<br />&nbsp;&nbsp;&nbsp;&nbsp;double target = 1; //seconds<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(elapsedTime &lt; target, String.Format("Query Initialization took {0}s, it should be less than {1}s", elapsedTime, target));<br />}</font><br /><br />We are not using a ServiceReferences.ClientConfig so the binding configuration is the same now as when we created the projects with the 5.2.1 release when Silverlight 3 was RTW.  (Or, at least I think they are.)<br /><br />Yes, the EM is logged in and connected.  The InitializeEntityManager method in my DomainModelEntityManager partial takes care of that since we use the anonymous login because we're on Oracle.<br /><br />I will run these other scenarios this morning:  A) DomainModel Test on server using AsyncParallelTask; and B) ClientModel Silverlight Test on client NOT using AsyncParallelTask.  I'm going to see if we have added anything to EntityChanging or EntityChanged (I don't think so, but I'm going to double check).  <br /><br />I was trying to figure out how to use Fiddler in my dev environment.  The Cross Domain policy error happens because Fiddler changes the URL.  Also, the VS2008 WebDev Server is running at http://localhost:9009 which Fiddler can't intercept because IE doesn't forward localhost to the proxy.  Do you have a link that has good instructions for that?  Or should I set up the Cross Domain policy?  Thanks.]]>
   </description>
   <pubDate>Fri, 02 Oct 2009 06:37:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5560#5560</guid>
  </item> 
  <item>
   <title>Performance Question : In test 3, did youalso use the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5553#5553</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 01-Oct-2009 at 2:08pm<br /><br />In test 3, did you&nbsp;also use the AsyncParallelTask? <DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>You will have some performance hit in Silverlight because the data has to be sent across the wire, but that hit shouldn't be as big as you're seeing.&nbsp; If you're not using a ServiceReferences.ClientConfig the default binding uses binary encoding.&nbsp; (Beta versions of DevForce Silverlight used text encoding.)&nbsp; If you are using a ClientConfig, what do the bindings look like?&nbsp; I'd really recommend using Fiddler to inspect the messages and request/response times.&nbsp; (The message sizes will probably be a bit large -- we've reduced some bloat in the coming release, and will be adding compression in a following release.)</DIV><DIV>&nbsp;</DIV><DIV>Out of curiosity, if you run a single async query in Silverlight test, w/o using the AsyncParallelTask, how long does that take?</DIV><DIV>&nbsp;</DIV><DIV>I think we already covered this before, but make sure the EntityManager used for the queries is both connected and logged in prior to executing the task.&nbsp; If it's not, you'll see lots of superfluous connect/login calls to the server.</DIV><DIV>&nbsp;</DIV><DIV>Async fetch logic, both pre- and post-, and the AsyncParallelTask,&nbsp;is the same in Silverlight as in non-Silverlight; so there is no difference in events fired or anything else.&nbsp; Property interceptors and validators are not fired during the data load, nor is PropertyChanged.&nbsp; The EntityChanging and EntityChanged events do fire.</DIV><DIV>&nbsp;</DIV><DIV>Edited to add &nbsp;- </DIV><DIV>The parallel task always returns the results from each async query back to the calling thread, so potentially you could see the async portion of all the queries complete, but the final post-processing involving the merge into the EntityManager cache all has to be done synchronously (because the EM is not threadsafe), so this could back up.&nbsp; (I haven't actually seen this is testing, but I believe it's possible.)</DIV><span style="font-size:10px"><br /><br />Edited by kimj - 01-Oct-2009 at 2:15pm</span>]]>
   </description>
   <pubDate>Thu, 01 Oct 2009 14:08:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5553#5553</guid>
  </item> 
  <item>
   <title>Performance Question : I tried a few things today:  1)...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5552#5552</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 01-Oct-2009 at 1:37pm<br /><br />I tried a few things today:<br /><br />1) I moved the queries into a client side Silverlight Unit Test so I could run them without any binding / UI issues.  Completely removing XAML and the UI from the stack did NOT improve performance at all.  The queries still take 60s to run.  This also took all of the callbacks and post query processing off the board too.  Here's the test code:<br /><br /><font face="Courier New, Courier, mono">&#091;TestMethod&#093;<br />&#091;Asynchronous&#093;<br />public void InitializationQueries()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;var em = LocalEntityManager.DefaultManager;<br />&nbsp;&nbsp;&nbsp;&nbsp;var task = AsyncParallelTask.Create();<br />&nbsp;&nbsp;&nbsp;&nbsp;task.AddAsyncQuery("BusAssociates", x =&gt; em.BusAssociates, null);<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;task.AddAsyncQuery("Zones", x =&gt; em.Zones, null);<br />&nbsp;&nbsp;&nbsp;&nbsp;EnqueueCallback(() =&gt; Logging.TimerStart());<br />&nbsp;&nbsp;&nbsp;&nbsp;EnqueueCallback(() =&gt; task.Execute(InitCompleted));<br />}<br />public void InitCompleted(AsyncParallelTaskCompletedArgs args) {<br />&nbsp;&nbsp;&nbsp;&nbsp;var cacheInitializationElapsedTime =  Math.Round(Logging.TimerStop()/1000,2);<br />&nbsp;&nbsp;&nbsp;&nbsp;EnqueueTestComplete();<br />&nbsp;&nbsp;&nbsp;&nbsp;double target = 15; //seconds<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(cacheInitializationElapsedTime &lt; target, String.Format("Query Initialization took {0}s, it should be less than {1}s", cacheInitializationElapsedTime, target));<br />}</font> <br /><br />2) I ran a unit test against the ServerModelEF project, thereby excluding all client-server, Ideablade and Silverlight code.  The 18 queries run in less than 1 second.  <br />The test looks like this:<br /><br /><font face="Courier New, Courier, mono">&#091;TestMethod&#093;<br />public void InitializationQueries()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;ServerModelEF.ModelEntities em = new ModelEntities();<br />&nbsp;&nbsp;&nbsp;&nbsp;var timerStart = DateTime.Now;<br />&nbsp;&nbsp;&nbsp;&nbsp;var items01 = from item in em.BusAssociates select item;<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(items01.Count() &gt; 0);<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;var items19 = from item in em.Zones select item;<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(items19.Count() &gt; 0);<br />&nbsp;&nbsp;&nbsp;&nbsp;var elapsedTime = Math.Round(DateTime.Now.Subtract(timerStart).TotalMilliseconds / 1000, 2);<br />&nbsp;&nbsp;&nbsp;&nbsp;double target = 1; //seconds<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(elapsedTime &lt; target, String.Format("Query Initialization took {0}s, it should be less than {1}s", elapsedTime, target));<br />}</font><br /><br />3) I ran the same test in the DomainModel project, this adds the Ideablade EntityManager and Ideablade layer, but is still server side and still excludes the silverlight stuff.  Same thing, all the queries run in a total of less than 1 second.  I changed the test to use the DomainModelEntityManager, like this:<br /><br /><font face="Courier New, Courier, mono">&#091;TestMethod&#093;<br />public void InitializationQueries()<br />{ <br />&nbsp;&nbsp;&nbsp;&nbsp;var em = new DomainModelEntityManager();<br />&nbsp;&nbsp;&nbsp;&nbsp;em.InitializeEntityManager();  //logs in the EM<br />&nbsp;&nbsp;&nbsp;&nbsp;var timerStart = DateTime.Now;<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />}</font><br /><br />In conclusion, at this point I have established that the client-server / silverlight / async version of the queries takes 60s, but the server only / sync version of the queries takes only 1s.<br />Any thoughts on where I should go next?  What is happening when an entity is Fetched?  Do any property interceptors, validators, events, lazy loaders, PropertyChanged, or such fire?  Where is the extra time coming from?<span style="font-size:10px"><br /><br />Edited by skingaby - 01-Oct-2009 at 1:38pm</span>]]>
   </description>
   <pubDate>Thu, 01 Oct 2009 13:37:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5552#5552</guid>
  </item> 
  <item>
   <title>Performance Question : The generated SQL is quite normal...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5537#5537</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 30-Sep-2009 at 7:44am<br /><br />The generated SQL is quite normal looking, given how ugly some EF SQL can be, and the SQL response times running those queries are near instant.<br />I am going to add a counter to my logging so I can count how many times some things fire.  Maybe I have out of control processes happening when the EntityManager assembles the items.  I'm also going to look at what is happening if I run those same queries asynchronously and synchronously in the server-side DomainModel (from a unit test project) and what is happening if I run those same queries in the ServerModelEF project too.  Thanks for the tips.  I'll get back to you.]]>
   </description>
   <pubDate>Wed, 30 Sep 2009 07:44:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5537#5537</guid>
  </item> 
  <item>
   <title>Performance Question : I don&amp;#039;t have an immediate...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5530#5530</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 29-Sep-2009 at 6:32pm<br /><br />I don't have an immediate answer for you, but I do have a few comments and more questions.<DIV>&nbsp;</DIV><DIV>First, what does an async query do that would take 10 seconds?&nbsp;&nbsp; Good question.&nbsp; An async query has 3 "phases":&nbsp; 1) where it checks if connected and logged in and whether the query can be satisfied from cache; 2) the async phase, where the request is sent to the EntityServer on a separate thread; and 3) the merge of the returned data into the EntityManager cache, done back on the calling thread.&nbsp; Various events are fired along the way also.&nbsp; Why this whole process would take 10 seconds for very little data I don't know, since we haven't seen this issue in our tests.&nbsp; Even launching Prism Explorer directly from our website, you generally see queries completing within a second or so.&nbsp; </DIV><DIV>&nbsp;</DIV><DIV>I would try to break this down a bit -- first see what the generated SQL looks like; next take that SQL and run it standalone within a query window (SQL*Plus or whatever) to see how long the database takes to execute it; next use Fiddler (or the network tool of your choice) to see what the request and response times are to the EntityServer.&nbsp;&nbsp; If all of this looks reasonably good, then I'd focus on what's happening as the data is merged in the EM cache.&nbsp; You will see the EntityChanging and EntityChanged events fired during the merge, and you'll see getter actions called if the data is bound to a UI control.&nbsp; It might be worthwhile to retrieve the data without having bound it to anything to get a better idea of how long the merge into cache is taking.</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 29 Sep 2009 18:32:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5530#5530</guid>
  </item> 
  <item>
   <title>Performance Question : I&amp;#039;ve set up an AsyncParallelTask...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5513#5513</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1499<br /><strong>Posted:</strong> 28-Sep-2009 at 4:21pm<br /><br />I've set up an AsyncParallelTask that runs 18 different entity queries to get all of the entities necessary for our grid form to be populated and editable.  The main entity has a ton of foreign keys, types, statuses, children, etc, so there are a lot of queries to run.&nbsp;&nbsp;&nbsp;We tried a giant entity query that used .Include() to pull in all the foreign keys but that query took FOREVER to run.  So, I split it up and am running each query independently as an AsyncQuery task in an AsyncParallelTask.  Most of the queries are short tables of 3-5 rows and a handful of columns, with a couple of them having 200-300 rows and 20 or so columns.  None are large tables with thousands of rows.  None have BLOB data in them.  The database is Oracle, using the DevArt dotConnect drivers.  I am using pre-compiled views in the ModelEF project.<br />The entire set takes just under 1 minute to run.<br />First, I broke the 18 queries down and ran each one separately.  I.e. One query task for each run.  <br />Then I added back each query one at a time to see what effect each additional query has on the total time.  Times are in milliseconds.  The logging is all client side and is displayed in a client-side log window as described elsewhere in this forum.  The timer starts immediately prior to creating the AsyncParallelTask as in this snippet: <br /><br />private void InitializeCache()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;Logging.TimerStart();<br />&nbsp;&nbsp;&nbsp;&nbsp;task = AsyncParallelTask.Create();<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;task.AddAsyncQuery(queryName, x =&gt; query, querySpecificCallback);<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;task.Execute(InitializationCallback);<br />}<br />private void InitializationCallback(AsyncParallelTaskCompletedArgs args)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;Logging.TimerStop();<br />}<br /><br />Timings:<br />1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9038.7200<br />2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  8805.6945<br />3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  8977.1328<br />4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9413.8232<br />5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9569.6812<br />6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9008.5924<br />7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9928.1546<br />8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9382.6516<br />9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9304.7823<br />10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9522.9849<br />11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9819.1170<br />12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9024.2361<br />13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9694.4298<br />14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9351.5400<br />15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 10099.7280<br />16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9741.2500<br />17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 10582.8940<br />18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 10333.8556<br /><br />1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-  9985.7012,  9810.7346<br />1+2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 10998.5140<br />1+2+3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - 13736.2736<br />1 to 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 15233.2812<br />1-5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 19135.6341<br />1-6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 20859.5651<br />1-7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 24581.1580<br />1-8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 26080.3900<br />1-9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 30593.7030<br />1-10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 32208.2180<br />1-11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 35689.7266<br />1-12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 40383.2564, 36399.0270, 38258.0331, <br />1-13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 41418.6368<br />1-14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 45418.3866<br />1-15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 47433.8568<br />1-16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 48622.9544<br />1-17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 55391.4640<br />1-18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  - 58385.8935, 56948.4435<br /><br />So, my question is:<br />What is each query doing that is taking 10 seconds?  What are the queries doing that increment the total time by 3-4 seconds?  Is there anything I can do to optimize this code / these queries / the EF loading times / the Entity construction time?  Etc.  Do you have any tips about enabling/disabling things at run time that can speed it up, for example, disabling the PropertyInterceptors on classes until AFTER the Async load has happened?<br />Thanks,<br />Simon]]>
   </description>
   <pubDate>Mon, 28 Sep 2009 16:21:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1499&amp;PID=5513#5513</guid>
  </item> 
 </channel>
</rss>