[CDO] First pass through resource contents slow? [message #1749264] |
Sun, 04 December 2016 18:12  |
Eclipse User |
|
|
|
Hi,
I have a project here that uses CDO (latest 4.5 release) with a MySQL database as storage. All components (client, server, storage) run on the same host. The client does the following actions more or less periodically:
1. Open transaction
2. Find a particular resource (always the same)
3. Pass through the contents of the resource several times (checking various things)
4. Add a new object to its contents
5. Commit
I have noticed that the first pass in a transaction through the contents of a CDOResource is very slow. For a resource with 5000 objects this loop takes nearly 1 second:
for(EObject o : resource.getContents()) {
... some simple stuff inside the loop, for example checking the type of each "o"...
}
Subsequent passes (i.e. for-loops) through the contents only take a few milliseconds, as long as they happen in the same transaction.
Is this the expected behavior? I don't see any database read-accesses during the various passes, not even across transactions, which means the data is cached in memory, correct?
As you can probably see, I am completely new to CDO. Please don't hesitate to shout for more information 
Thanks,
ru
|
|
|
|
|
|
|
|
|
|
Re: [CDO] First pass through resource contents slow? [message #1749474 is a reply to message #1749407] |
Wed, 07 December 2016 02:48  |
Eclipse User |
|
|
|
It's not really bad, but performance depends on so many things. I'll try to explain:
A CDOObject is a thin wrapper that contains only a few internal data values, i.e., CDOID, CDOView, CDOState, and a reference to the "real" data, a so-called CDORevision. The more expensive CDORevision is softly cached in the CDOSession. Recreating the CDOObject is cheap if the needed CDORevision is still cached. Cache-warming can help to speed up first iterations, and extra strong references can help to keep CDORevisions in the cache for future iterations.
It's hard for me to tell where your specific bottleneck really is, but maybe the following articles about CDO internals help you to better understand:
How Scalable are my Models?
Concurrent Access to Models
|
|
|
Powered by
FUDForum. Page generated in 0.07189 seconds