Rickard Öberg schrieb:
On 8/2/11 17:16 , Falko Bräutigam wrote:
If we could get the Query API to return Values instead of Entities, I
think things like that could be way way more efficient.
Hmm... honestly I don't get the idea. I have to learn more about that.
Any pointers for me to read?
If you are doing a Query just to show some data in a UI, why load the
data as Entities instead of just as Values? Apart from all the overhead
with Entities compared to Values, it would also be possible to generate
some of the data to be used in Values. You said you used computed
properties, for example. That could be done in the Query, perhaps.
Wow! But how to implement an efficient cache if SoftReference is evil
then???
Major YES. I used SoftReferences, found out the hard way in production
that this causes weird OutOfMemory issues, and then the JRockit folks
told me to stay away. Major voodoo going on to support SoftReferences,
so not recommended.
Manual LRU? Ok, great. But when to check/run it??? Are there
differences between Weak and SoftReferences in this regard?
For caching purposes Weak references are not that interesting.
Basically, if a LRU cache was to be used in the UoW, then upon loading
an entity and the cache is "full", then find last accessed one, which is
not modified, and evict it.
Yes, but what is "full"?
After some investigation on this I found this one:
http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=cfd518f51afc7780e5188276b5f9?bug_id=6912889
First, thanks Rickard for pointing me to this. I see exactly this behaviour in
my qi4j app with SoftReferences. Now I understand better whats going on.
It turns out that the GC policy for SoftReferences itself is the problem. But on
the other hand, memory management is clearly the job of the VM/GC. Doing this
"by hand" via a separate thread, checking memory and releasing references,
introduces a bunch of other problems *and* is probably less efficient.
somewhat perplexed...
-Falko
--
Falko Bräutigam
http://polymap.org/polymap3
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev