<?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 : Memory Utilisation</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Memory Utilisation</description>
  <pubDate>Tue, 21 Apr 2026 14:09:01 -700</pubDate>
  <lastBuildDate>Thu, 01 Jul 2010 13:41:46 -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=1898</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>Memory Utilisation : I wouldn&amp;#039;t necessarily make...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7482#7482</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 01-Jul-2010 at 1:41pm<br /><br />I wouldn't necessarily make all queries to the local datastore as datasource only.&nbsp; (This will turn off query inversion, but will still cache the entities returned by the query).&nbsp; I would consider clearing out unneeded entities after a workflow or periodically clearing the cache.&nbsp; If you have isolated workflows, one technique than can be handy is to create a separate EntityManager as a sandbox for that workflow.&nbsp; Import whatever entities you need into it, and then throw it away when you're done.&nbsp; This might get you the best performance/memory tradeoff and can help minimize any bookkeeping code.]]>
   </description>
   <pubDate>Thu, 01 Jul 2010 13:41:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7482#7482</guid>
  </item> 
  <item>
   <title>Memory Utilisation : 1) Ah, yes Ting. It had been a...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7406#7406</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=718" rel="nofollow">agrogers</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 24-Jun-2010 at 6:33am<br /><br />1) Ah, yes Ting.&nbsp; It had been a while since i had read just how the CacheThenDataSource query method works.&nbsp; So you are right in that any requests for objects based on primary key will find them in the cache.&nbsp; That should be a lot of them.<br><br>2) I think what you are saying is: 1) grab the objects you think you might need 2) write them to a local store 3) direct all queries to the local data store by changing the query strategy to datasource only.&nbsp; Is that close?<br><br>We are developing a school administration database.&nbsp; So there is not a lot of media data.&nbsp; Analysing the queries going to the server more seems to suggest that the query inversion is grabbing stuff we weren't expecting.&nbsp; So we are working through the implications of that now.<br><br>thanks<br>Andrew<br>]]>
   </description>
   <pubDate>Thu, 24 Jun 2010 06:33:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7406#7406</guid>
  </item> 
  <item>
   <title>Memory Utilisation : 1) I&amp;#039;m glad you&amp;#039;re reading...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7399#7399</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 23-Jun-2010 at 7:03pm<br /><br /><DIV>1)&nbsp; I'm glad you're reading the Developers Guide ;)&nbsp; The&nbsp;exception to this is if you are looking for an object by primary key (either explicitly, or more commonly through a relational navigation).&nbsp; We are&nbsp;able to check the cache first in this case because this is still a safe operation.</DIV><DIV>&nbsp;</DIV><DIV>The reason we clear the query cache is complicated, but&nbsp;basically revolves around the fact that we cannot guarantee that the conditions in the cache still satisfy the subquery constraints after objects have been removed.&nbsp; See Query Inversion if you're curious.</DIV><DIV>&nbsp;</DIV><DIV>2)&nbsp; In the simplest scenario, you just download&nbsp;all the objects you need, save it to the local database, and then clear the in-memory cache.&nbsp; You can then query for whatever objects you need out of the local database, and you can still go back to the main database if you need.</DIV><DIV>&nbsp;</DIV><DIV>What kind of application are you writing where this is a concern?&nbsp; Unless you have multimedia data or offline search requirements, it would take a user quite a long time to perform enough workflows to get that much data.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Wed, 23 Jun 2010 19:03:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7399#7399</guid>
  </item> 
  <item>
   <title>Memory Utilisation : Thanks Ting1. &amp;gt;&amp;gt;&amp;gt; so...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7385#7385</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=718" rel="nofollow">agrogers</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 22-Jun-2010 at 10:05pm<br /><br />Thanks Ting<br><br>1. &gt;&gt;&gt; so you may notice a few additional trips to the database afterwards<br>I thought that when the query cache was cleared DevForce assumed that no objects were in the entity cache and so calls were *always* satisfied from the database.&nbsp; Pg 240 of the Dev Guide says: "Unfortunately, removing those entities clears the entire query cache. The PersistenceManager will satisfy future queries from the database until it has rebuild its query cache.".&nbsp; So I dont see the point of keeping the Entity Cache when all future requests never use the Entity Cache because of the clearing of the Query Cache.<br><br>2,3. Can you point me to further info on 'using a local database as the cache'?&nbsp; I am familiar with writing the cache to a local store for using the application in disconnected mode.&nbsp; But I dont see how that helps reduce memory utilisation.&nbsp;&nbsp; Do you mean that Devforce can use SQL Express (say) as its cache rather than an in memory cache?&nbsp; That would certainly reduce memory utilisation but i can't imagine how that would be possible...<br><br>thanks<br>Andrew<br>]]>
   </description>
   <pubDate>Tue, 22 Jun 2010 22:05:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7385#7385</guid>
  </item> 
  <item>
   <title>Memory Utilisation : 1. Removing objects from cache...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7353#7353</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 18-Jun-2010 at 12:44pm<br /><br />1.&nbsp; Removing objects from cache will not cause a constraint violation of referential integrity.&nbsp; However, it might be odd if you remove only a few of the LineItems from an Order, but leave the rest.&nbsp; That's why EntityManager.FindEntityGraph() is&nbsp;a useful method in this context.&nbsp; Removing objects from cache also clears the query cache (different from the object cache), so you may notice a few additional trips to the database afterwards.&nbsp; Therefore, I would recommend&nbsp;that you evict objects from&nbsp;the cache at a coarse level in the application, and not perform this overly frequently.<DIV></DIV><DIV>&nbsp;</DIV><DIV>2,3.&nbsp; A few hundred megabytes should be no problem.&nbsp; If you have millions of objects in memory, the in-memory LINQ queries may start to slow down.&nbsp; Otherwise, the concerns would be the same as with any other application - primarily paging memory to disk.&nbsp; If it gets this large, I would consider using a local database as the cache.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 18 Jun 2010 12:44:48 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7353#7353</guid>
  </item> 
  <item>
   <title>Memory Utilisation : Thanks for your response Ting....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7349#7349</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=718" rel="nofollow">agrogers</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 17-Jun-2010 at 11:29pm<br /><br />Thanks for your response Ting.&nbsp; We are trying to determine what is 'normal' to determine whether or not what we have is normal.&nbsp; Of course 'normal' is not easily defined!&nbsp; A few general thoughts from from what you have said.<br><br>1. I thought removing objects from the cache was bad as it can compromise referential integrity.&nbsp; Either we empty the cache entirely or we don't remove anything.&nbsp; Is that correct?<br><br>2. Is it possible for you to give me a guide on what memory consumption you would be happy with in a well designed DevForce app?&nbsp; 10s of MBs? 100MBs? GBs?<br><br>3. Is there a point where Devforce starts to perform poorly because the cache has got too large?&nbsp; <br><br>Thanks<br>Andrew<br><br><br>]]>
   </description>
   <pubDate>Thu, 17 Jun 2010 23:29:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7349#7349</guid>
  </item> 
  <item>
   <title>Memory Utilisation : Hi, those are good questions....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7347#7347</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 17-Jun-2010 at 9:31pm<br /><br /><P>Hi, those are good questions.&nbsp; The DevForce in memory cache isn't designed to store an entire database, but with the typical size of database objects, you should be able to work with hundreds of thousands of objects on a modern machine with a few gigs of ram.&nbsp; If you have tables with large binary data, there are some strategies to deal with this (e.g. leave them unmapped and fetch them on demand).</P><DIV>If you are consuming a large amount of memory, then you can remove the objects from the cache after a particular workflow is done.&nbsp;&nbsp;(Use EntityManager.RemoveEntities(), also EntityManager.FindEntityGraph() is handy for this).&nbsp; If you know you won't be needing a query again soon, you can also issue it with a QueryStrategy of DataSourceOnly and this will prevent DevForce from caching additional objects needed to reperform the query in memory (This is probably why you are measuring&nbsp;an 8x expansion.&nbsp; There are likely more objects cached in memory than you realize.&nbsp; We also store the original state of the object so you can perform an undo back to it's original state.)</DIV><DIV>&nbsp;</DIV><DIV>DevForce also works well with multiple databases, so you if you need to work with massive data sets on the client, you can save to a local database like SQL Server Express.</DIV><DIV>&nbsp;</DIV><DIV>Is there a particular scenario you've got that would require special treatment?</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 17 Jun 2010 21:31:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7347#7347</guid>
  </item> 
  <item>
   <title>Memory Utilisation : HiWe have started analysing our...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7331#7331</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=718" rel="nofollow">agrogers</a><br /><strong>Subject:</strong> 1898<br /><strong>Posted:</strong> 15-Jun-2010 at 11:31pm<br /><br />Hi<br><br>We have started analysing our application memory usage and it seems to be using more than we expected.&nbsp; The Model.dll is 5.1Mb and is made up of 338 tables.&nbsp; Initialising the PersistenceManager consumes about 30Mb.&nbsp; Data loaded into memory consumes about 8 times the memory the same amount of data consumes in a Jet DB.&nbsp; This means that the application can quickly grow to hundreds of MB ... which doesnt seem good.<br><br>Is this normal for a Devforce app?&nbsp; What are the implications of a Devforce app growing to hundreds of MBs?&nbsp; And is there some documentation we should be following on the best practices with respect to memory management.<br><br>Thanks<br>Andrew<br>]]>
   </description>
   <pubDate>Tue, 15 Jun 2010 23:31:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1898&amp;PID=7331#7331</guid>
  </item> 
 </channel>
</rss>