Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] bad performances for few objects(retrieving 58000 objects takes 5 minutes)
[CDO] bad performances for few objects [message #629413] Tue, 28 September 2010 08:04 Go to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Hello,

I'm currently working on creating mock-ups for a project we are just starting. This project has several needs which match with the CDO technology (EMF model, remote access, revisions, offline mode, ...).

So I'm trying to use CDO in a project example since few days, but I have big performance problems: My standard model has only about 58000 objects for 26 classes (so i imagine the structure in the generated database should be approximatively the same), but retrieving the biggest tables takes almost 1 minute !

As the total model is about 10Mo, I tried to retrieve all the objects at the start of the software (making local, and so faster future accesses), but I have to retrieve objects one by one if I want them to be stored in my local model (a query "Select cdo_id FROM alltables" doesn't seems to store objects in the local model.

Well, i'm blocked here. And with such performances, the only solutions i have is to renounce using CDO and to implement my own solution (which will be nearly the same).

Could someone give me some trick to solve this problem ?

Thank you,
Guillaume

Note: I'm using the default h2 database, and i followed the Tweaking CDO Performance

[Updated on: Tue, 28 September 2010 12:24]

Report message to a moderator

Re: [CDO] bad performances for few objects [message #629434 is a reply to message #629413] Tue, 28 September 2010 09:28 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060902030903080506010900
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Guillaume,

I'm not sure if you experience performance problems when storing objects (i.e. committing transactions) or when loading objects. I suspect you meant the latter.

By default CDO loads objects on demand and that can cause many server round trips. Sometimes it's better to load sub trees of your model with one server roundtrip. Please try CDOObject.cdoPrefetch() and note that this method is also present and functional for CDOResources (because they are CDOObjects as well).

Does that help?

Cheers
/Eike
Contact: http://www.esc-net.de Blogger <http://thegordian.blogspot.com>Twitter <http://twitter.com/eikestepper>Linkedin <http://de.linkedin.com/in/eikestepper>Xing <http://www.xing.com/profile/Eike_Stepper>
Article: What exactly is inside that p2 repository? < http://thegordian.blogspot.com/2010/05/what-exactly-is-insid e-that-p2.html>

I'm speaking at Eclipse Summit Europe 2010 <http://www.eclipsesummit.org/>



Am 28.09.2010 10:04, schrieb Guillaume P.:
> Hello,
>
> I'm currently working on creating mock-ups for a project we are just starting. This project has several needs which match with the CDO technology (EMF model, remote access, revisions, offline mode, ...).
>
> So I'm trying to use CDO in a project example since few days, but I have big performance problems: My standard model has only about 58000 objects for 26 classes (so i imagine the structure in the generated database should be approximatively the same), but retrieving the biggest tables takes almost 1 minute !
>
> As the total model is about 10Mo, I tried to retrieve all the objects at the start of the software (making local, and so faster future accesses), but I have to retrieve objects one by one if I want them to be stored in my local model (a query "Select cdo_id FROM alltables" doesn't seems to store objects in the local model.
>
> Well, i'm blocked here. And with such performances, the only solutions i have is to renounce using CDO and to implement my own solution (which will be nearly the same).
>
> Could someone give me some trick to solve this problem ?
>
> Thank you,
> Guillaume
>
> Note: I'm using the default h2 database, and i followed the http://wiki.eclipse.org/Tweaking_CDO_Performance

--------------060902030903080506010900
Content-Type: multipart/related;
boundary="------------060407050307050600030504"


--------------060407050307050600030504
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
Hi Guillaume,<br>
<br>
I'm not sure if you experience performance problems when storing
objects (i.e. committing transactions) or when loading objects. I
suspect you meant the latter.<br>
<br>
By default CDO loads objects on demand and that can cause many
server round trips. Sometimes it's better to load sub trees of your
model with one server roundtrip. Please try CDOObject.cdoPrefetch()
and note that this method is also present and functional for
CDOResources (because they are CDOObjects as well).<br>
<br>
Does that help?<br>
<br>
<!--WISESTAMP_SIG_38888_START--><span style="color: black;">
<div dir="ltr">
<div>Cheers<br>
/Eike<br>
</div>
<div style="padding: 5px 0pt; font-family: arial,sans-serif;
font-size: 13.3px;"><span style="color: gray;">Contact: <a
href="http://www.esc-net.de">http://www.esc-net.de</a></span>
<a href="http://thegordian.blogspot.com" style="padding: 0pt
2px; color: blue; font-size: 10pt;" _service=""><img
src="cid:part1.09090702.03050304@esc-net.de" alt="Blogger"
style="vertical-align: middle; padding-bottom: 5px;"
border="0" height="16" width="16"></a><a
href="http://twitter.com/eikestepper" style="padding: 0pt
2px; color: blue; font-size: 10pt;" _service=""><img
src="cid:part2.03050606.09030907@esc-net.de" alt="Twitter"
style="vertical-align: middle; padding-bottom: 5px;"
border="0" height="16" width="16"></a><a
href="http://de.linkedin.com/in/eikestepper" style="padding:
0pt 2px; color: blue; font-size: 10pt;" _service=""><img
src="cid:part3.07060504.00070701@esc-net.de"
alt="Linkedin" style="vertical-align: middle;
padding-bottom: 5px;" border="0" height="16" width="16"></a><a
href="http://www.xing.com/profile/Eike_Stepper"
style="padding: 0pt 2px; color: blue; font-size: 10pt;"
_service=""><img
src="cid:part4.06080402.09030008@esc-net.de" alt="Xing"
style="vertical-align: middle; padding-bottom: 5px;"
border="0" height="16" width="16"></a></div>
<div style="color: gray; font-size: 13.3px; padding-bottom:
5px;">Article: <span style="color: blue; text-decoration:
underline;"><a
href=" http://thegordian.blogspot.com/2010/05/what-exactly-is-insid e-that-p2.html"
undefined="">What exactly is inside that p2 repository?</a></span></div>
<div><br>
<a href="http://www.eclipsesummit.org/"><img
src="cid:part5.06060702.01030401@esc-net.de" alt="I'm
speaking at Eclipse Summit Europe 2010" border="0"
height="100" width="100"></a>
<br>
<br>
</div>
</div>
</span><!--WISESTAMP_SIG_38888_END--><br>
<br>
Am 28.09.2010 10:04, schrieb Guillaume P.:
<blockquote cite="mid:i7s7d6$3kn$1@news.eclipse.org" type="cite">Hello,
<br>
<br>
I'm currently working on creating mock-ups for a project we are
just starting. This project has several needs which match with the
CDO technology (EMF model, remote access, revisions, offline mode,
...).
<br>
<br>
So I'm trying to use CDO in a project example since few days, but
I have big performance problems: My standard model has only about
58000 objects for 26 classes (so i imagine the structure in the
generated database should be approximatively the same), but
retrieving the biggest tables takes almost 1 minute !
<br>
<br>
As the total model is about 10Mo, I tried to retrieve all the
objects at the start of the software (making local, and so faster
future accesses), but I have to retrieve objects one by one if I
want them to be stored in my local model (a query "Select cdo_id
FROM alltables" doesn't seems to store objects in the local model.
<br>
<br>
Well, i'm blocked here. And with such performances, the only
solutions i have is to renounce using CDO and to implement my own
solution (which will be nearly the same).
<br>
<br>
Could someone give me some trick to solve this problem ?
<br>
<br>
Thank you,
<br>
Guillaume
<br>
<br>
Note: I'm using the default h2 database, and i followed the
<a class="moz-txt-link-freetext" href="http://wiki.eclipse.org/Tweaking_CDO_Performance">http://wiki.eclipse.org/Tweaking_CDO_Performance</a>
<br>
</blockquote>
</body>
</html>

--------------060407050307050600030504
Content-Type: image/png;
name="blogger.png"
Content-Transfer-Encoding: base64
Content-ID: <part1.09090702.03050304@esc-net.de>
Content-Disposition: inline;
filename="blogger.png"

iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADkUExURf9xEv9m AP////9lAP+Q
SP9kAP9jAP9fAP9nAf9vD//x5/9hAP/iz/9iAP9eAP/s4P9vEP9yEv9qAP9q B/+LRP+we/90
I/+RSP/z6/+jZv/y6P+8kP/59f5yE//awf/Ttv9hAf9nAv/17v+4if9sC/9o BP+bWP/r3v/k
0v+wfP+QRv/o2f9gAP+OQ/93HP/l0/+0gv/Rsv/9/P/j0P+pcP+0hf/dx//D m//+/v+td/9o
AP+NQv/Yvf+zgv/x6P/q2/9xG//p2f9pAP/s3//8+fxxE//ex/+AK/9oCP/j 0f/Uuv///4Xw
StcAAABMdFJOU/////////////////////////////////////////////// ////////////
/////////////////////////////////////////wCejeTMAAAAsklEQVR4 2kSP1w6DMBAE
7cMGQg0hvffee++d//+f2IaIeTlppNXtIo88UAjxEIlhjCUG5lwJQuwoulqh FuUGcWGSiTF7
bt40EEoXBKtyIPQS5PffFqyHlhCS2obTK5kDmJ8lXxgA0zsPXer0L3zSUVmI D9ip3SC+hKwQ
2CxCtXYYL25gu1S8bf4jib5fTM+MNE079jom/+KwJUojwnAVifcQ46jM4M23 BHmkEK53iPcT
YACE/Q4KzoVQVwAAAABJRU5ErkJggg==
--------------060407050307050600030504
Content-Type: image/png;
name="twitter.png"
Content-Transfer-Encoding: base64
Content-ID: <part2.03050606.09030907@esc-net.de>
Content-Disposition: inline;
filename="twitter.png"

iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/ AP+gvaeTAAAA
CXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAQAAAAEABcxq3DAAABxUlE QVQ4y4WTMW4U
QRBFX3X3zoy8FgZphTCYAEg4gAPEYbgBJEgEXIALkHMfAjIwItnAAfLK2JYB r3dmuj7BzI5m
2WBLqqzq//q/fxt9NTmrzo7MCIhgRpWSsaMSgEta5czcjYtWTKPxfALZXTEE 2wmAxLXD11VL
BZy2MAuJB/iuA3oAoJb4lUUCVkAGTM5t06gjATMjBiPFaFsADvx1MTFoBd/q zHkMeLcLgCEe
JqjbrCJ1IAkghGDz20Z/XEzMMMTnZTsSYANMAl7fq7YlZOBaUCCk4WowwyRA mBmL7CxcmwDu
rh+rzKU71YhQ/dnr8VbiaRF4MgmbAAZkxJU7lRk3Wby5W3FcJlbSICAjZjFS jJ42rSXWgoWL
fYPfLvaCMTVxJ0XoJTmQ/stF6GPABDhzcepi7uJ74yQDuXcDErjjGhkwNvHx xCjMOMkCg3eX
S85zyVEMtGt24GWVxvsM5yi3+nBV8/7iBmJv0gaZQMZhNL4cHXBYdDkY7HQL vD0oebVfQuud
a8FGHSAaP1vnpMmbHgDEECwafLq/x8fZlGfJKCVKiapvXLyoEsdl3JYwBMpd uW1YEjlz4aMh
AY+iURiU/Vf/B6EE4kjfs5YLAAAAAElFTkSuQmCC
--------------060407050307050600030504
Content-Type: image/png;
name="linkedin.png"
Content-Transfer-Encoding: base64
Content-ID: <part3.07060504.00070701@esc-net.de>
Content-Disposition: inline;
filename="linkedin.png"

iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/ AP+gvaeTAAAA
CXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAQAAAAEABcxq3DAAACGklE QVQ4y6WTO2sU
URTHf3dmdp0kTnZJzErSrPjKYqNY2GljodhoLRLB1sLCD2DrZxAsfCAE/AaC grY+SBQSFTSC
xizGzZ3MTiYz92UxY5KNYuOBP+eew/3/73lwxfWHT9yjuR8YL0CwyxygAAPo Cqr0ntFcvjBB
cH++x8WzJzm8v/EnWVdks0PEgNWO95/XePD4HZ4ADk6MAhD6Hs26/08yBjwr ODrZBK0JADyv
LP7GsX2Evse9xR5Lsvgr+XfsO7ctoKwj9AWh7wEQIFCF+3sFGjCmgiJwQFwY Yge3X3cZrwXM
r2SDg9tJ1rokaw1alRXI3NAO61w60AAHTkE7qtNu1PjSUywsb3L60AgjNcHz hZgXb39WApoA
C3FqsIGjMxYC8OZbxlQU0GmFTLdCznWireV0pobYSDKevuzilMZDg0wN/cxu XdrMLVqX53TT
cu3OJ87cmmdlrQBgemoYKTMwqhSI+4Z0QMBhjANgcTnj1UdJHGd8Xc0AmBit Ecu0moGGODH0
h7cF8tyidSmgjSWWG6AUWpkypw1xLwXA4z8tQINcN/T3moEWtLZbr0mZQV5s 55RFJuU8RHR1
1iWtIzQ8nxOtIVCw9D2lWbM06w4ZZ8wtrEJRcLw9TDMUyKRg7kOPSHQR0ZVZ lyRjMDkOOVAU
FfLS57viHRaJLsHM+THuPtuDUgLTW2U0X672t47rrw82vOu/z9w8xS+MkDzV Boy6+QAAAABJ
RU5ErkJggg==
--------------060407050307050600030504
Content-Type: image/png;
name="xing.png"
Content-Transfer-Encoding: base64
Content-ID: <part4.06080402.09030008@esc-net.de>
Content-Disposition: inline;
filename="xing.png"

iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsT AAALEwEAmpwY
AAABsklEQVR42mP8//8/AymAEb+G1x9333hU9fffZy52ZTONrQQ0/P7z7sLd hJfvN7Mw80mL
ROkqTodqAIKvv379+fuXhZmZh50dpv7f49dLLt1LYWD4ryRZCETsrJIIDYdu 3y5fu16AizPE
0CTFzgoo8fPXoxPX/T9/v8DHbWCito6LXRHFDw/evnXpm3D39Ws1Eck9xVmy wqLP3/SevlXC
ysKtLtuoJFmMxdObL17ymzqN8S9LnZddua/VrUcWD149FRNwNFFby8oiiEXD itNnImfN5WTi
nBhu7Gvw5OLdiv+MQnqKU6WEI7AE6+vPnx17+68+fmGrJL0wRe/rl/jbL94r isfqKs1kZuJE
1/Dt16/27TtatmzjYeZcnuZpqnDi3J16FmZxYDhKCAViibiVp8+Ur1v39N0H X12DFRkJ33/u
O3LVk+E/i5xYqq7iNCwaXn769PLTZ0ZGBnFePjE+3j9/3155kPvk9XIudgV9 5XnCfI6Ek8a7
T4dO3vD4+++HlHC4kepywhr+/P0ITEIPXk5jZxXTVpgE1EY48X36euHs7fBv P+8CVespzYGH
FSOpyRsAAuDh4a3m5z0AAAAASUVORK5CYII=
--------------060407050307050600030504
Content-Type: image/gif;
name="100x100_speaking.gif"
Content-Transfer-Encoding: base64
Content-ID: <part5.06060702.01030401@esc-net.de>
Content-Disposition: inline;
filename="100x100_speaking.gif"

R0lGODlhZABkAOZ/APb3+VNYfigtUDRDchhWpwM6mkRXjThrsCdirVJ7u0p2 uExflWyGrQU0
asnX6aq31ImZUxRFoaOqOWaIwgRGlubr87bG4C44YMHDzmeGZYqMrtLRFuHi 5zpalGxskRZD
lVt/vdHZ6TRlqzlTiJiy1Wd7qExtrB00XDtfnH2SvyFeq0ZttQl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qhwpGh0r
ZEDEW9FyqgzNIW3NC33UR23IZfzTG53BHFEBYkDTVK3UVn3RhvwqaSVfMD3U isABcEDVYj3W
ZJ3VIgQra6XIXp2wGBAAZf3WY/wqWh0pWx0rMiDUa83WATBCdN3Xfv3XQVJc d53XknBDYgDY
iE1P18XFJmRAA3hN2JHb1okd2IstXzJAA1AN2Y0AABmkATyD1pU9KapDA5it 2fbA2ThkBGiy
2vMyQiLU2KSdoqbt1Sla25xt2y0427q924UQCAA7
--------------060407050307050600030504--

--------------060902030903080506010900--


Re: [CDO] bad performances for few objects [message #629464 is a reply to message #629434] Tue, 28 September 2010 12:12 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Hi Eike,

Thank for your answer. I'm actually talking about loading data.
I already tried to set this parameter to a higher value on each object before accessing it's content. But this doesn't seem to have any effect. :-/
I also tried to optimize the CollectionLoadingPolicy, but without success.

Regards,
Guillaume

Re: [CDO] bad performances for few objects [message #629504 is a reply to message #629464] Tue, 28 September 2010 14:07 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
I think to something: When I make an sql query to retrieve all the objects from the database, it takes only 3 or 5 seconds... but even if I store these objects in a list (to avoid the GC to remove them), when I try to access the content via the CDOResource, objects are re-loaded from the repository, taking, this time, several minutes.

When all objects have been read via the resource (using the EObject methods), they are not reloaded while next accesses.

Is my access to content not correct (forcing to load objects one by one instead of loading everything in one time) ?
public Object[] getChildren(Object parentElement) {
        if (parentElement instanceof CDOObject) {
                ((CDOObject)parentElement).cdoPrefetch(10000);
                return ((EObject)parentElement).eContents().toArray();
        }
        return null;
}

what method should I call to retrieve all objects through only one request (or at least one for each concerned table) ?

Why object accessed from a sql Query (like "SELECT cdo_id FROM information_schema.TABLES") are not cached like are objects accessed from EObject methods ?

Regards,
Guillaume

[Updated on: Wed, 29 September 2010 09:58]

Report message to a moderator

Re: [CDO] bad performances for few objects [message #629834 is a reply to message #629504] Wed, 29 September 2010 16:42 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Hi Guillaume,

On 28.09.2010 16:07, Guillaume P. wrote:
> I think to something: When I make an sql query to retrieve all the
> objects from the database, it takes only 3 or 5 seconds... but even if I
> store these objects in a list (to avoid the GC to remove them), when I
> try to access the content via the resource, objects are re-loaded from
> the repository, taking, this time, several minutes.
>
> When all objects have been read via the resource (using the EObject
> methods), they are not reloaded while next accesses.
>
> Is my access to content not correct (forcing to load objects one by one
> instead of loading everything in one time) ? Object[] childs =
> parentCDOObject.eContents().toArray();
>
> Why object accessed from a sql Query are not cached like objects
> accessed from EObject methods ?

I'm not entirely sure what you are comparing. The plain approach is

CDOView view = session.openView();
CDOResource res = view.getResource("/whatever");
Object[] obj = res.getContents().toArray();

(this should be equivalent to your code mentioned above).

Can you give an example of how you collect the objects with an SQL
query? I'm currently unsure how you query for objects, because actually,
you only can query for CDOIDs. So I guess what you actually store in
your list in your implementation you described initially, is proxy
objects which are not filled with actual values (which would explain why
they are loaded on access ...).

Cheers
Stefan
Re: [CDO] bad performances for few objects [message #629991 is a reply to message #629834] Thu, 30 September 2010 09:08 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Hi Stefan,

Sorry if i'm not enough clear.

What i'm comparing is performances loading objects via EObject methods, or via sql query.

To load objects via EObject methods, I use quite the same process as you (calling getContents() on an object containing about 5 000 objects).
To load objects via an SQL query, I use something like this:

List<EObject> res = session.openView().createQuery("sql", "SELECT cdo_id FROM cdo_objects").getResult(EObject.class);
System.out.println("from sql size: "+res.size());
System.out.println("object 35 is proxy: "+((EObject)res.get(35)).eIsProxy());


And the result is:

Quote:
from sql size: 58355
object 35 is proxy: false


So, what I don't understand is why loading 5 000 object by calling getContents() takes about 50s, while loading 58 000 objects via an SQL query takes only 1s (and as seen above, loaded objects are not only proxies).
Moreover objects loaded from SQL queries don't seems to be cached (when accessing them via EObject methods, they are reloaded as if they wouldn't have been loaded before).

I don't know if i am more clear ^^

Thanks for your help

Guillaume
Re: [CDO] bad performances for few objects [message #630214 is a reply to message #629991] Fri, 01 October 2010 07:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 30.09.2010 11:08, schrieb Guillaume P.:
> Hi Stefan,
>
> Sorry if i'm not enough clear.
>
> What i'm comparing is performances loading objects via EObject methods, or via sql query.
>
> To load objects via EObject methods, I use quite the same process as you (calling getContents() on an object containing about 5 000 objects).
> To load objects via an SQL query, I use something like this:
>
> List<EObject> res = session.openView().createQuery("sql", "SELECT cdo_id FROM cdo_objects").getResult(EObject.class);
> System.out.println("from sql size: "+res.size());
> System.out.println("object 35 is proxy: "+((EObject)res.get(35)).eIsProxy());
In CDO a different mechanism for proxying is used, one that really releases memory in proxy state and not increases it as the EMF proxies do.

The correct assertion would be CDOObject.cdoState() == CDOState.PROXY. If you didn't generate CDOObject into your interfaces or if you're using the new legacy mode you can obtain the CDOObject for your object with CDOUtil.getCDOObject(eObject).

>
> And the result is:
>
> Quote:
>> from sql size: 58355
>> object 35 is proxy: false
>
>
> So, what I don't understand is why loading 5 000 object by calling getContents() takes about 50s, while loading 58 000 objects via an SQL query takes only 1s (and as seen above, loaded objects are not only proxies).
In both cases, and by default, you are encountering the 1+n effect: There's one server round trip for getting the CDOIDs of all the objects. Then you have one more roundtrip per object that is accessed and not yet loaded.

> Moreover objects loaded from SQL queries don't seems to be cached (when accessing them via EObject methods, they are reloaded as if they wouldn't have been loaded before).
As Stefan said (IIRC.), in both cases only IDs are transfered. No objects are cached during that. But if you access one object and it gets loaded by that, then it will certainly be cached. I suspect your objects from the query are all still in state PROXY.

Cheers
/Eike


Re: [CDO] bad performances for few objects [message #630230 is a reply to message #630214] Fri, 01 October 2010 09:17 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Hi Eike,

Thanks for your response.
I changed the method to check if the object loaded is a proxy (my objects are generated CDOObjects):

java.util.List<EObject> res = session.openView().createQuery("sql", "SELECT cdo_id FROM cdo_objects").getResult(EObject.class);
System.out.println("from sql size: "+res.size());
System.out.println("object 35 is proxy: "+(((CDOObject)res.get(35)).cdoState() == CDOState.PROXY));


But the result is the same:

Quote:
from sql size: 58355
object 35 is proxy: false


And even if those loaded objects are proxies, is there some solution to avoid the 1+n effect ? making only one query to get all data (or one by object type instead of one by object) ?
Re: [CDO] bad performances for few objects [message #630238 is a reply to message #630230] Fri, 01 October 2010 09:25 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 01.10.2010 11:17, schrieb Guillaume P.:
> Hi Eike,
>
> Thanks for your response.
> I changed the method to check if the object loaded is a proxy (my objects are generated CDOObjects):
>
> java.util.List<EObject> res = session.openView().createQuery("sql", "SELECT cdo_id FROM cdo_objects").getResult(EObject.class);
> System.out.println("from sql size: "+res.size());
> System.out.println("object 35 is proxy: "+(((CDOObject)res.get(35)).cdoState() == CDOState.PROXY));
>
> But the result is the same:
> Quote:
>> from sql size: 58355
>> object 35 is proxy: false
>
>
> And even if those loaded objects are proxies, is there some solution to avoid the 1+n effect ? making only one query to get all data (or one by object type instead of one by object) ?
As I mentioned in my first reply, CDOObject.cdoPrefetch() can be used.

Cheers
/Eike


Re: [CDO] bad performances for few objects [message #630245 is a reply to message #630238] Fri, 01 October 2010 10:02 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
As you can see above, I am already using the prefetch method.
But using the PrefetchingPolicy and the CollectionLoadingPolicy doesn't seem to have any effect.

Have you any other idea ?

Thanks
Guillaume
Re: [CDO] bad performances for few objects [message #630252 is a reply to message #630245] Fri, 01 October 2010 10:04 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 01.10.2010 12:02, schrieb Guillaume P.:
> As you can see above, I am already using the prefetch method.
> But using the PrefetchingPolicy and the CollectionLoadingPolicy doesn't seem to have any effect.
Please send us an executable test that demonstrates that.

>
> Have you any other idea ?
No, the CDOObject.cdoPrefetch(int) method or the CDOView.Options.setRevisionPrefetchingPolicy(CDORevisionPref etchingPolicy) should help. If they don't they have to be fixed, see above.

Cheers
/Eike


Re: [CDO] bad performances for few objects [message #630265 is a reply to message #630252] Fri, 01 October 2010 10:57 Go to previous messageGo to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Hi Guillaume,

just to make sure that we are not on the wrong track.

Are you using the legacy mode? Maybe by accident?

This could explain that loading the objects takes so long.

Cheers,

Martin

Am 01.10.2010 12:04, schrieb Eike Stepper:
> Am 01.10.2010 12:02, schrieb Guillaume P.:
>> As you can see above, I am already using the prefetch method.
>> But using the PrefetchingPolicy and the CollectionLoadingPolicy
>> doesn't seem to have any effect.
> Please send us an executable test that demonstrates that.
>
>>
>> Have you any other idea ?
> No, the CDOObject.cdoPrefetch(int) method or the
> CDOView.Options.setRevisionPrefetchingPolicy(CDORevisionPref etchingPolicy)
> should help. If they don't they have to be fixed, see above.
>
> Cheers
> /Eike
>
Re: [CDO] bad performances for few objects [message #630266 is a reply to message #630265] Fri, 01 October 2010 10:57 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 01.10.2010 12:57, schrieb Martin Flügge:
> Hi Guillaume,
>
> just to make sure that we are not on the wrong track.
>
> Are you using the legacy mode? Maybe by accident?
Didn't we add the CDOUtil.setLegacyModeDefault(boolean) method particularly to prevent legacy objects from being used accidentally?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> This could explain that loading the objects takes so long.
>
> Cheers,
>
> Martin
>
> Am 01.10.2010 12:04, schrieb Eike Stepper:
>> Am 01.10.2010 12:02, schrieb Guillaume P.:
>>> As you can see above, I am already using the prefetch method.
>>> But using the PrefetchingPolicy and the CollectionLoadingPolicy
>>> doesn't seem to have any effect.
>> Please send us an executable test that demonstrates that.
>>
>>> Have you any other idea ?
>> No, the CDOObject.cdoPrefetch(int) method or the
>> CDOView.Options.setRevisionPrefetchingPolicy(CDORevisionPref etchingPolicy)
>> should help. If they don't they have to be fixed, see above.
>>
>> Cheers
>> /Eike
>>


Re: [CDO] bad performances for few objects [message #630270 is a reply to message #630266] Fri, 01 October 2010 11:29 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
No, I don't use this mode (I saw on another topic that you said it could make performance problems).

I'm trying to clean my code before sending it to you...
Re: [CDO] bad performances for few objects [message #630284 is a reply to message #630270] Fri, 01 October 2010 12:26 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
This is a plugin for Eclipse. It is composed of


    a manager to open an access to the repository and open editors.
    an editor to explore the resources in the database.
    a CDO server


The goal here is not to have something with a lot of functionalities but to test performances when loading objects.
The repository address is hard coded in the manager, and a tree viewer is user to load dynamically objects.

I cannot provide my own CDO model, but this should be tested on a model containing a lot of object (mine is 58000) in order to see the problem. This example doesn't provide edition features, so the CDO model should be added or imported through another UI (the default CDO UI for example).

package example;

import java.util.ArrayList;

import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDOSession;
import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.List;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.ViewPart;


/**
 * View for managing the database and its resources.
 */
public class DBManager extends ViewPart {
    private List resourcesNameList;
    private ArrayList<CDOResource> resources;
    private Action openDbAction;
    private Action closeDbAction;
    
    private CDOSession session = null;
    private CDOTransaction transaction = null;
    
    private final static String host = "localhost:2036";
    private final static String repoName = "repo1";

    
    /**
     * Create the manager
     */
    public DBManager() {
        super();
        // no resources when starting
        resources = new ArrayList<CDOResource>();
    }

    @Override
    public void createPartControl(Composite parent) {
        // no resources when starting
        resourcesNameList = new List(parent, 0);

        createActions();
        createToolbar();
    }

    @Override
    public void setFocus() {
        resourcesNameList.setFocus();
    }

    /**
     * Create actions to open or close the access to the database
     */
    public void createActions() {
        openDbAction = new Action("Access Database...") {
            public void run() { 
                openDatabase();
            }
        };
        openDbAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD));
        openDbAction.setEnabled(true);

        closeDbAction = new Action("Close access to Database") {
            public void run() {
                closeDatabase();
            }
        };
        closeDbAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
        closeDbAction.setEnabled(false);

        // Add selection listener.
        resourcesNameList.addSelectionListener(new SelectionListener() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                updateActionEnablement();
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                updateActionEnablement();
            }
        });
        
        // add double click listener to open editors
        resourcesNameList.addMouseListener(new MouseListener() {
            @Override
            public void mouseDoubleClick(MouseEvent e) {
                if (resourcesNameList.getSelectionCount() > 0) {
                    // get the selected CDOResource
                    CDOResource resToOpen = resources.get(resourcesNameList.getSelectionIndex());
                    
                    try {
                        // open an editor for this resource
                        IEditorInput editorInput = new DBEditorInput(resToOpen, resToOpen.getPath());
                        IDE.openEditor(
                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
                                editorInput,
                                "db.ui.dbEditor");
                    } catch (PartInitException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                }
            }

            @Override
            public void mouseDown(MouseEvent e) { }

            @Override
            public void mouseUp(MouseEvent e) { }
        });
    }

    /**
     * Access to the Database and read the different resources available
     */
    private void openDatabase() {
        //open session and transaction
        session = openSession(host, repoName);
        CDOCollectionLoadingPolicy policy = CDOUtil.createCollectionLoadingPolicy(0, 10000);
        session.options().setCollectionLoadingPolicy(policy);
        session.options().getProtocol().setTimeout(IConnector.NO_CHANNEL_TIMEOUT);
        transaction = session.openTransaction();
        
        // search all stored resources
        transaction.getRootResource().cdoView().options().setRevisionPrefetchingPolicy(CDOUtil.createRevisionPrefetchingPolicy(CDORevision.DEPTH_INFINITE));
        for (EObject eobj : transaction.getRootResource().getContents()) {
            if (eobj instanceof CDOResource) {
                CDOResource resource = (CDOResource)eobj;
                
                // add resource to lists
                resourcesNameList.add(resource.getName().toString());
                resources.add(resource);
            }
        }
        
        updateActionEnablement();
    }

    /**
     * Close the access to the current Database.
     */
    private void closeDatabase() {
        if (transaction != null) {
            transaction.close();
            transaction = null;
        }
        if (session != null) {
            session.close();
            session = null;
        }
        resourcesNameList.removeAll();
        resources.clear();
        
        updateActionEnablement();
    }

    /**
     * Update the close and open actions state.
     */
    private void updateActionEnablement() {
        if (session == null) {
            closeDbAction.setEnabled(false);
            openDbAction.setEnabled(true);
        } else {
            closeDbAction.setEnabled(true);
            openDbAction.setEnabled(false);
        }
    }

    /**
     * Create toolbar.
     */
    private void createToolbar() {
        IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
        mgr.add(openDbAction);
        mgr.add(closeDbAction);
    }
    
    /**
     * Open a new session on the given repository
     * @param host host where the repository is stored
     * @param repository name of the repository to open
     * @return opened session
     */
    private CDOSession openSession(String host, String repository) {
        IManagedContainer container = ContainerUtil.createContainer();
        container.activate();
        Net4jUtil.prepareContainer(container);
        TCPUtil.prepareContainer(container);
        IConnector connector = TCPUtil.getConnector(container, host);
        
        // configure session
        CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration();
        configuration.setConnector(connector);
        configuration.setRepositoryName(repository);
        
        // Open CDO session
        return configuration.openSession();
    }
}





package example;

import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.ui.CDOItemProvider;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;


/**
 * This editor input is used by the DbEditor to know which is the linked CDOResource.
 */
public class DBEditorInput extends PlatformObject implements IEditorInput {
    private CDOResource resource;

    private String resourcePath;
    
    
    public DBEditorInput(CDOResource resource, String resourcePath) {
        this.resource = resource;
        this.resourcePath = resourcePath;
    }

    public String getResourcePath() {
        return resourcePath;
    }

    public boolean exists() {
        return true;
    }
    
    public CDOResource getResource() {
        return resource;
    }

    public ImageDescriptor getImageDescriptor() {
        return CDOItemProvider.getViewImageDescriptor(resource.cdoView());
    }

    public String getName() {
        if (resourcePath != null) {
            return new Path(resourcePath).lastSegment();
        }

        return resource.cdoView().getSession().getRepositoryInfo().getName();
    }

    public IPersistableElement getPersistable() {
        return null;
    }

    public String getToolTipText() {
        return "myFile";
    }

    @Override
    public int hashCode() {
        return ObjectUtil.hashCode(resource.cdoView()) ^ ObjectUtil.hashCode(resourcePath);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this)
        {
            return true;
        }

        if (obj instanceof DBEditorInput)
        {
            DBEditorInput that = (DBEditorInput)obj;
            return ObjectUtil.equals(resource, that.getResource());
        }

        return false;
    }
}





package example;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;


/**
 * This editor is a simple example to load and display in a tree the content of a CDOResource.
 */
public class DBEditor extends EditorPart {
    TreeViewer tree;
    

    public DBEditor() {}

    @Override
    public void doSave(IProgressMonitor monitor) {}

    @Override
    public void doSaveAs() {}

    @Override
    public void init(IEditorSite site, IEditorInput input) throws PartInitException {
        if (input instanceof DBEditorInput) {
            setSite(site);
            setInputWithNotify(input);
            setPartName(input.getName());
        } else {
            
        }
    }

    @Override
    public boolean isDirty() {
        return false;
    }

    @Override
    public boolean isSaveAsAllowed() {
        return false;
    }

    @Override
    public void createPartControl(Composite parent) {
        tree = new TreeViewer(parent);
        
        // The tree will display the content of the CDOResource linked to the editor
        tree.setContentProvider(new DBTreeContentProvider());
        tree.setLabelProvider(new DBLabelProvider());
        tree.setInput(((DBEditorInput)getEditorInput()).getResource());
    }

    @Override
    public void setFocus() {}
}





package example;

import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;


/**
 * This treeContentProvider load dynamically objects from the CDOResource for the DBEditor tree.
 */
public class DBTreeContentProvider implements ITreeContentProvider {
    TreeViewer viewer = null;
    EObject rootObject = null;
    
    
    @Override
    public void dispose() {}

    @Override
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        this.viewer = (TreeViewer)viewer;
        rootObject = (EObject)newInput;
    }
    
    @Override
    public Object[] getElements(Object inputElement) {
        return getChildren(inputElement);
    }

    @Override
    public Object[] getChildren(Object parentElement) {
        if (parentElement instanceof CDOObject) {
            // start timing
            System.out.print("getChildren("+parentElement+") = ");
            long t1 = System.currentTimeMillis();
            
            // load objects (or get from cache)
            Object[] res = ((EObject)parentElement).eContents().toArray();
            
            // stop timing and display
            System.out.println(System.currentTimeMillis() - t1);
            
            return res;
        }

        return null;
    }

    @Override
    public Object getParent(Object element) {
        if (element instanceof EObject) {
            return ((EObject)element).eContainer();
        }

        return null;
    }

    @Override
    public boolean hasChildren(Object element) {
        if (element instanceof CDOObject) {
            return !((EObject)element).eContents().isEmpty();
        }

        return false;
    }
}





package example;

import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;


/**
 * Label provider to provide labels in the tree displaying the CDOResource.
 * Labels just display the type of the object and its version.
 */
public class DBLabelProvider implements ILabelProvider {

    @Override
    public void addListener(ILabelProviderListener listener) {}

    @Override
    public void dispose() {}

    @Override
    public boolean isLabelProperty(Object element, String property) {
        return false;
    }

    @Override
    public void removeListener(ILabelProviderListener listener) {}

    @Override
    public Image getImage(Object element) {
        return null;
    }

    @Override
    public String getText(Object element) {
        return ((EObject)element).eClass().getName()
            +" (v"+((CDOObject)element).cdoRevision().getVersion()+")";
    }

}





And the CDO server configuration:

<?xml version="1.0" encoding="UTF-8"?>
<cdoServer>
    
    <!--acceptor type="http"/ -->
    
    <acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
        <!-- negotiator type="challenge" description="/temp/users.db"/ -->
    </acceptor>
    
    <repository name="repo1">
        <property name="overrideUUID" value="1ff5d226-b1f0-40fb-aba2-0c31b38c764f"/>
        <property name="supportingAudits" value="true"/>
        <property name="verifyingRevisions" value="false"/>
        <property name="currentLRUCapacity" value="10000"/>
        <property name="revisedLRUCapacity" value="100"/>
        
        <store type="db">
            <mappingStrategy type="horizontal">
                <property name="qualifiedNames" value="true"/>
                <property name="toManyReferences" value="ONE_TABLE_PER_REFERENCE"/>
                <property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
            </mappingStrategy>
            
                   <dbAdapter name="h2"/>
            <dataSource class="org.h2.jdbcx.JdbcDataSource"
                uRL="jdbc:h2:_database/cdodb1"/>
        </store>
    </repository>
    
</cdoServer>


... That's it ! ^^

Thank you in advance for your help,

Guillaume
Re: [CDO] bad performances for few objects [message #630313 is a reply to message #630284] Fri, 01 October 2010 14:16 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Hi Guillaume,

Is it possible that you assemble this in a zip so that i can just extract an eclipse project and use a contained launch config to run your code? My time is really somewhat limited and all this support is free. Please try to make it as quick as possible and bear with me.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 01.10.2010 14:27, schrieb Guillaume P.:
> This is a plugin for Eclipse. It is composed of
>
>
> a manager to open an access to the repository and open editors.
> an editor to explore the resources in the database.
> a CDO server
>
>
> The goal here is not to have something with a lot of functionalities but to test performances when loading objects.
> The repository address is hard coded in the manager, and a tree viewer is user to load dynamically objects.
>
> I cannot provide my own CDO model, but this should be tested on a model containing a lot of object (mine is 58000) in order to see the problem. This example doesn't provide edition features, so the CDO model should be added or imported through another UI (the default CDO UI for example).
>
> package example;
>
> import java.util.ArrayList;
>
> import org.eclipse.emf.cdo.common.revision.CDORevision;
> import org.eclipse.emf.cdo.eresource.CDOResource;
> import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
> import org.eclipse.emf.cdo.net4j.CDOSession;
> import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
> import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
> import org.eclipse.emf.cdo.transaction.CDOTransaction;
> import org.eclipse.emf.cdo.util.CDOUtil;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.jface.action.Action;
> import org.eclipse.jface.action.IToolBarManager;
> import org.eclipse.net4j.Net4jUtil;
> import org.eclipse.net4j.connector.IConnector;
> import org.eclipse.net4j.tcp.TCPUtil;
> import org.eclipse.net4j.util.container.ContainerUtil;
> import org.eclipse.net4j.util.container.IManagedContainer;
> import org.eclipse.swt.events.MouseEvent;
> import org.eclipse.swt.events.MouseListener;
> import org.eclipse.swt.events.SelectionEvent;
> import org.eclipse.swt.events.SelectionListener;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.List;
> import org.eclipse.ui.IEditorInput;
> import org.eclipse.ui.ISharedImages;
> import org.eclipse.ui.PartInitException;
> import org.eclipse.ui.PlatformUI;
> import org.eclipse.ui.ide.IDE;
> import org.eclipse.ui.part.ViewPart;
>
>
> /**
> * View for managing the database and its resources.
> */
> public class DBManager extends ViewPart {
> private List resourcesNameList;
> private ArrayList<CDOResource> resources;
> private Action openDbAction;
> private Action closeDbAction;
> private CDOSession session = null;
> private CDOTransaction transaction = null;
> private final static String host = "localhost:2036";
> private final static String repoName = "repo1";
>
> /**
> * Create the manager
> */
> public DBManager() {
> super();
> // no resources when starting
> resources = new ArrayList<CDOResource>();
> }
>
> @Override
> public void createPartControl(Composite parent) {
> // no resources when starting
> resourcesNameList = new List(parent, 0);
>
> createActions();
> createToolbar();
> }
>
> @Override
> public void setFocus() {
> resourcesNameList.setFocus();
> }
>
> /**
> * Create actions to open or close the access to the database
> */
> public void createActions() {
> openDbAction = new Action("Access Database...") {
> public void run() { openDatabase();
> }
> };
> openDbAction.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD ));
> openDbAction.setEnabled(true);
>
> closeDbAction = new Action("Close access to Database") {
> public void run() {
> closeDatabase();
> }
> };
> closeDbAction.setImageDescriptor(PlatformUI.getWorkbench().g etSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_D ELETE));
> closeDbAction.setEnabled(false);
>
> // Add selection listener.
> resourcesNameList.addSelectionListener(new SelectionListener() {
> @Override
> public void widgetSelected(SelectionEvent e) {
> updateActionEnablement();
> }
>
> @Override
> public void widgetDefaultSelected(SelectionEvent e) {
> updateActionEnablement();
> }
> });
> // add double click listener to open editors
> resourcesNameList.addMouseListener(new MouseListener() {
> @Override
> public void mouseDoubleClick(MouseEvent e) {
> if (resourcesNameList.getSelectionCount() > 0) {
> // get the selected CDOResource
> CDOResource resToOpen = resources.get(resourcesNameList.getSelectionIndex());
> try {
> // open an editor for this resource
> IEditorInput editorInput = new DBEditorInput(resToOpen, resToOpen.getPath());
> IDE.openEditor(
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage(),
> editorInput,
> "db.ui.dbEditor");
> } catch (PartInitException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> }
> }
>
> @Override
> public void mouseDown(MouseEvent e) { }
>
> @Override
> public void mouseUp(MouseEvent e) { }
> });
> }
>
> /**
> * Access to the Database and read the different resources available
> */
> private void openDatabase() {
> //open session and transaction
> session = openSession(host, repoName);
> CDOCollectionLoadingPolicy policy = CDOUtil.createCollectionLoadingPolicy(0, 10000);
> session.options().setCollectionLoadingPolicy(policy);
> session.options().getProtocol().setTimeout(IConnector.NO_CHA NNEL_TIMEOUT);
> transaction = session.openTransaction();
> // search all stored resources
> transaction.getRootResource().cdoView().options().setRevisio nPrefetchingPolicy(CDOUtil.createRevisionPrefetchingPolicy(C DORevision.DEPTH_INFINITE));
> for (EObject eobj : transaction.getRootResource().getContents()) {
> if (eobj instanceof CDOResource) {
> CDOResource resource = (CDOResource)eobj;
> // add resource to lists
> resourcesNameList.add(resource.getName().toString());
> resources.add(resource);
> }
> }
> updateActionEnablement();
> }
>
> /**
> * Close the access to the current Database.
> */
> private void closeDatabase() {
> if (transaction != null) {
> transaction.close();
> transaction = null;
> }
> if (session != null) {
> session.close();
> session = null;
> }
> resourcesNameList.removeAll();
> resources.clear();
> updateActionEnablement();
> }
>
> /**
> * Update the close and open actions state.
> */
> private void updateActionEnablement() {
> if (session == null) {
> closeDbAction.setEnabled(false);
> openDbAction.setEnabled(true);
> } else {
> closeDbAction.setEnabled(true);
> openDbAction.setEnabled(false);
> }
> }
>
> /**
> * Create toolbar.
> */
> private void createToolbar() {
> IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
> mgr.add(openDbAction);
> mgr.add(closeDbAction);
> }
> /**
> * Open a new session on the given repository
> * @param host host where the repository is stored
> * @param repository name of the repository to open
> * @return opened session
> */
> private CDOSession openSession(String host, String repository) {
> IManagedContainer container = ContainerUtil.createContainer();
> container.activate();
> Net4jUtil.prepareContainer(container);
> TCPUtil.prepareContainer(container);
> IConnector connector = TCPUtil.getConnector(container, host);
> // configure session
> CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration();
> configuration.setConnector(connector);
> configuration.setRepositoryName(repository);
> // Open CDO session
> return configuration.openSession();
> }
> }
>
>
>
>
>
> package example;
>
> import org.eclipse.core.runtime.Path;
> import org.eclipse.core.runtime.PlatformObject;
> import org.eclipse.emf.cdo.eresource.CDOResource;
> import org.eclipse.emf.cdo.ui.CDOItemProvider;
> import org.eclipse.jface.resource.ImageDescriptor;
> import org.eclipse.net4j.util.ObjectUtil;
> import org.eclipse.ui.IEditorInput;
> import org.eclipse.ui.IPersistableElement;
>
>
> /**
> * This editor input is used by the DbEditor to know which is the linked CDOResource.
> */
> public class DBEditorInput extends PlatformObject implements IEditorInput {
> private CDOResource resource;
>
> private String resourcePath;
> public DBEditorInput(CDOResource resource, String resourcePath) {
> this.resource = resource;
> this.resourcePath = resourcePath;
> }
>
> public String getResourcePath() {
> return resourcePath;
> }
>
> public boolean exists() {
> return true;
> }
> public CDOResource getResource() {
> return resource;
> }
>
> public ImageDescriptor getImageDescriptor() {
> return CDOItemProvider.getViewImageDescriptor(resource.cdoView());
> }
>
> public String getName() {
> if (resourcePath != null) {
> return new Path(resourcePath).lastSegment();
> }
>
> return resource.cdoView().getSession().getRepositoryInfo().getName( );
> }
>
> public IPersistableElement getPersistable() {
> return null;
> }
>
> public String getToolTipText() {
> return "myFile";
> }
>
> @Override
> public int hashCode() {
> return ObjectUtil.hashCode(resource.cdoView()) ^ ObjectUtil.hashCode(resourcePath);
> }
>
> @Override
> public boolean equals(Object obj) {
> if (obj == this)
> {
> return true;
> }
>
> if (obj instanceof DBEditorInput)
> {
> DBEditorInput that = (DBEditorInput)obj;
> return ObjectUtil.equals(resource, that.getResource());
> }
>
> return false;
> }
> }
>
>
>
>
>
> package example;
>
> import org.eclipse.core.runtime.IProgressMonitor;
> import org.eclipse.jface.viewers.TreeViewer;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.ui.IEditorInput;
> import org.eclipse.ui.IEditorSite;
> import org.eclipse.ui.PartInitException;
> import org.eclipse.ui.part.EditorPart;
>
>
> /**
> * This editor is a simple example to load and display in a tree the content of a CDOResource.
> */
> public class DBEditor extends EditorPart {
> TreeViewer tree;
>
> public DBEditor() {}
>
> @Override
> public void doSave(IProgressMonitor monitor) {}
>
> @Override
> public void doSaveAs() {}
>
> @Override
> public void init(IEditorSite site, IEditorInput input) throws PartInitException {
> if (input instanceof DBEditorInput) {
> setSite(site);
> setInputWithNotify(input);
> setPartName(input.getName());
> } else {
> }
> }
>
> @Override
> public boolean isDirty() {
> return false;
> }
>
> @Override
> public boolean isSaveAsAllowed() {
> return false;
> }
>
> @Override
> public void createPartControl(Composite parent) {
> tree = new TreeViewer(parent);
> // The tree will display the content of the CDOResource linked to the editor
> tree.setContentProvider(new DBTreeContentProvider());
> tree.setLabelProvider(new DBLabelProvider());
> tree.setInput(((DBEditorInput)getEditorInput()).getResource( ));
> }
>
> @Override
> public void setFocus() {}
> }
>
>
>
>
>
> package example;
>
> import org.eclipse.emf.cdo.CDOObject;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.jface.viewers.ITreeContentProvider;
> import org.eclipse.jface.viewers.TreeViewer;
> import org.eclipse.jface.viewers.Viewer;
>
>
> /**
> * This treeContentProvider load dynamically objects from the CDOResource for the DBEditor tree.
> */
> public class DBTreeContentProvider implements ITreeContentProvider {
> TreeViewer viewer = null;
> EObject rootObject = null;
> @Override
> public void dispose() {}
>
> @Override
> public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
> this.viewer = (TreeViewer)viewer;
> rootObject = (EObject)newInput;
> }
> @Override
> public Object[] getElements(Object inputElement) {
> return getChildren(inputElement);
> }
>
> @Override
> public Object[] getChildren(Object parentElement) {
> if (parentElement instanceof CDOObject) {
> // start timing
> System.out.print("getChildren("+parentElement+") = ");
> long t1 = System.currentTimeMillis();
> // load objects (or get from cache)
> Object[] res = ((EObject)parentElement).eContents().toArray();
> // stop timing and display
> System.out.println(System.currentTimeMillis() - t1);
> return res;
> }
>
> return null;
> }
>
> @Override
> public Object getParent(Object element) {
> if (element instanceof EObject) {
> return ((EObject)element).eContainer();
> }
>
> return null;
> }
>
> @Override
> public boolean hasChildren(Object element) {
> if (element instanceof CDOObject) {
> return !((EObject)element).eContents().isEmpty();
> }
>
> return false;
> }
> }
>
>
>
>
>
> package example;
>
> import org.eclipse.emf.cdo.CDOObject;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.jface.viewers.ILabelProvider;
> import org.eclipse.jface.viewers.ILabelProviderListener;
> import org.eclipse.swt.graphics.Image;
>
>
> /**
> * Label provider to provide labels in the tree displaying the CDOResource.
> * Labels just display the type of the object and its version.
> */
> public class DBLabelProvider implements ILabelProvider {
>
> @Override
> public void addListener(ILabelProviderListener listener) {}
>
> @Override
> public void dispose() {}
>
> @Override
> public boolean isLabelProperty(Object element, String property) {
> return false;
> }
>
> @Override
> public void removeListener(ILabelProviderListener listener) {}
>
> @Override
> public Image getImage(Object element) {
> return null;
> }
>
> @Override
> public String getText(Object element) {
> return ((EObject)element).eClass().getName()
> +" (v"+((CDOObject)element).cdoRevision().getVersion()+")";
> }
>
> }
>
>
>
>
>
> And the CDO server configuration:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cdoServer>
> <!--acceptor type="http"/ -->
> <acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
> <!-- negotiator type="challenge" description="/temp/users.db"/ -->
> </acceptor>
> <repository name="repo1">
> <property name="overrideUUID" value="1ff5d226-b1f0-40fb-aba2-0c31b38c764f"/>
> <property name="supportingAudits" value="true"/>
> <property name="verifyingRevisions" value="false"/>
> <property name="currentLRUCapacity" value="10000"/>
> <property name="revisedLRUCapacity" value="100"/>
> <store type="db">
> <mappingStrategy type="horizontal">
> <property name="qualifiedNames" value="true"/>
> <property name="toManyReferences" value="ONE_TABLE_PER_REFERENCE"/>
> <property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
> </mappingStrategy>
> <dbAdapter name="h2"/>
> <dataSource class="org.h2.jdbcx.JdbcDataSource"
> uRL="jdbc:h2:_database/cdodb1"/>
> </store>
> </repository>
> </cdoServer>
>
> ... That's it ! ^^
>
> Thank you in advance for your help,
>
> Guillaume


Re: [CDO] bad performances for few objects [message #630331 is a reply to message #630313] Fri, 01 October 2010 15:46 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Sorry for all my questions, but I'm on those problems since several weeks now and I don't know where else I could find help. I understand you cannot use all your time for making support, and I thank you for all your help.

So, here is (http://dl.free.fr/vBvkgsg0L) the zip file containing the full plugin project. As told before, I cannot provide my big CDO model (because of confidentiality rules), but I think you have one for your tests. You just have to change the "host" and "repoName" constants in the DBManager class to make the plugin reading your own repository.

Hopping that nothing is missing, thanks you again for your help.

Guillaume
Re: [CDO] bad performances for few objects [message #630365 is a reply to message #630266] Fri, 01 October 2010 18:04 Go to previous messageGo to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Am 01.10.2010 12:57, schrieb Eike Stepper:
> Am 01.10.2010 12:57, schrieb Martin Flügge:
>> Hi Guillaume,
>>
>> just to make sure that we are not on the wrong track.
>>
>> Are you using the legacy mode? Maybe by accident?
> Didn't we add the CDOUtil.setLegacyModeDefault(boolean) method
> particularly to prevent legacy objects from being used accidentally?
>

Ah, right. My mistake. Legacy cannot be used accidentally.
Re: [CDO] bad performances for few objects [message #630436 is a reply to message #630331] Sat, 02 October 2010 13:13 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Hi Guillaume,

thanks for your code. I did the following to create a repository with
50000 objects:

------------------------------------------------------------ --------

CDOSession session = openSession(host, repoName);
CDOTransaction tx = session.openTransaction();

EPackage pkg = EMFUtil.createEPackage("foobar", "fb", "http://foobar");
EClass[] cls = new EClass[10];

for(int i=0; i<10; i++) {
cls[i] = EMFUtil.createEClass(pkg, "Class"+i, false, false);
EMFUtil.createEAttribute(cls[i], "att",
EcorePackage.eINSTANCE.getEString());
}

CDOUtil.prepareDynamicEPackage(pkg);

Random rand = new Random();

for(int r = 0; r<10; r++) {
CDOResource res = tx.createResource("/res"+r);

for(int o=0; o<5000; o++) {
EObject obj = EcoreUtil.create(cls[rand.nextInt(10)]);
obj.eSet(obj.eClass().getEStructuralFeature("att"), "obj"+r * 10000
+ o);
res.getContents().add(obj);
}
}

System.out.println("Committing ...");

tx.commit();
tx.close();
session.close();
System.out.println("Done ...");

------------------------------------------------------------ --------

Next, I altered your code slightly, so it measures initialization time
as well (more or less openDatabase() in your code). Then I ran the
experiment as follows:
- Start the server
- Start the client
- Connect to Repository
- Open res1
- Close res1
- Open res1 again
- Close res1
- Open res3
- Close res3
- Open res3 again
- Close res3
- Terminate client
- Terminate server


Your code as provided leads to these results on my machine:

------------------------------------------------------------
initializing = 3377
getChildren(CDOResource@OID26358) = 21523 (<- open res1)
getChildren(CDOResource@OID26358) = 45 (<- open res1 again)
getChildren(CDOResource@OID19749) = 18070 (<- open res3)
getChildren(CDOResource@OID19749) = 9 (<- open res3 again)
------------------------------------------------------------

as a first step: you are configuring the collection loading policy
wrong. The first parameter is what should be fetched at once, so 0 is
not a good idea if you want to preload your whole model.

Therefore I used
CDOCollectionLoadingPolicy policy =
CDOUtil.createCollectionLoadingPolicy(10000, 10000);
instead of your
CDOCollectionLoadingPolicy policy =
CDOUtil.createCollectionLoadingPolicy(0, 10000);

which lead to

------------------------------------------------------------
initializing = 875
getChildren(CDOResource@OID26358) = 12730
getChildren(CDOResource@OID26358) = 52
getChildren(CDOResource@OID19749) = 10366
getChildren(CDOResource@OID19749) = 5
------------------------------------------------------------

This is already a 50% speed-up.


Next, you are configuring your revision prefetching policy with
CDORevision.INFINITE_DEPTH (which is -1). Because of an if-statement in
createRevisionPrefetchingPolicy, revision prefetching for negative
values is deactivated. Therefore, you actually never used the revision
prefetching policy. I have to clarify with Eike if
CDORevision.INFINITE_DEPTH is actually not allowed here, maybe we should
state this more explicitly in the documentation.

Anyway, using

transaction.options().setRevisionPrefetchingPolicy(CDOUtil.c reateRevisionPrefetchingPolicy(10));
instead of your

transaction.options().setRevisionPrefetchingPolicy(CDOUtil.c reateRevisionPrefetchingPolicy(CDORevision.INFINITE_DEPTH));

in addition to the modified collection loading policy above leads to

------------------------------------------------------------
initializing = 5473
getChildren(CDOResource@OID26358) = 6655
getChildren(CDOResource@OID26358) = 73
getChildren(CDOResource@OID19749) = 6522
getChildren(CDOResource@OID19749) = 10
------------------------------------------------------------

which makes the initialization slower, but again boosts performance by
40-50%.

I hear you asking the next question, why the first access is still
slower than the second one. I cannot state why at this time. I have to
do further analysis. Maybe its a bug either in the prefetching policy or
in our understanding of how it should work :-)

But finally, you wanted to preload your whole model in the client. You
can do this quite simply by replacing the whole prefetching policy with
one explicit call:

transaction.getRootResource().cdoPrefetch(CDORevision.DEPTH_ INFINITE);

(yes, CDORevision.DEPTH_INFINITE is actually allowed here ...)

this makes the initialization really slow, but leads to instant
subsequent access as you wanted it:

------------------------------------------------------------
initializing = 157339
getChildren(CDOResource@OID26358) = 190
getChildren(CDOResource@OID19749) = 121
getChildren(CDOResource@OID26358) = 52
getChildren(CDOResource@OID19749) = 6
------------------------------------------------------------


I hope this analysis helps you a bit and you are invited to share your
further experience with us by, for example, complementing
http://wiki.eclipse.org/Tweaking_CDO_Performance with your insights.
Obviously, there are some things not entirely clear in there.


Have a nice weekend,
Cheers,
Stefan







On 01.10.2010 17:46, Guillaume P. wrote:
> Sorry for all my questions, but I'm on those problems since several
> weeks now and I don't know where else I could find help. I understand
> you cannot use all your time for making support, and I thank you for all
> your help.
>
> So, here is http://dl.free.fr/vBvkgsg0L the zip file containing the full
> plugin project. As told before, I cannot provide my big CDO model
> (because of confidentiality rules), but I think you have one for your
> tests. You just have to change the "host" and "repoName" constants in
> the DBManager class to make the plugin reading your own repository.
>
> Hopping that nothing is missing, thanks you again for your help.
>
> Guillaume
Re: [CDO] bad performances for few objects [message #630562 is a reply to message #630436] Mon, 04 October 2010 07:16 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 02.10.2010 15:13, schrieb Stefan Winkler:
> Hi Guillaume,
>
> thanks for your code. I did the following to create a repository with 50000 objects:
>
> ------------------------------------------------------------ --------
>
> CDOSession session = openSession(host, repoName);
> CDOTransaction tx = session.openTransaction();
>
> EPackage pkg = EMFUtil.createEPackage("foobar", "fb", "http://foobar");
> EClass[] cls = new EClass[10];
>
> for(int i=0; i<10; i++) {
> cls[i] = EMFUtil.createEClass(pkg, "Class"+i, false, false);
> EMFUtil.createEAttribute(cls[i], "att", EcorePackage.eINSTANCE.getEString());
> }
>
> CDOUtil.prepareDynamicEPackage(pkg);
>
> Random rand = new Random();
>
> for(int r = 0; r<10; r++) {
> CDOResource res = tx.createResource("/res"+r);
>
> for(int o=0; o<5000; o++) {
> EObject obj = EcoreUtil.create(cls[rand.nextInt(10)]);
> obj.eSet(obj.eClass().getEStructuralFeature("att"), "obj"+r * 10000 + o);
> res.getContents().add(obj);
> }
> }
>
> System.out.println("Committing ...");
>
> tx.commit();
> tx.close();
> session.close();
> System.out.println("Done ...");
>
> ------------------------------------------------------------ --------
>
> Next, I altered your code slightly, so it measures initialization time as well (more or less openDatabase() in your code). Then I ran the experiment as follows:
> - Start the server
> - Start the client
> - Connect to Repository
> - Open res1
> - Close res1
> - Open res1 again
> - Close res1
> - Open res3
> - Close res3
> - Open res3 again
> - Close res3
> - Terminate client
> - Terminate server
>
>
> Your code as provided leads to these results on my machine:
>
> ------------------------------------------------------------
> initializing = 3377
> getChildren(CDOResource@OID26358) = 21523 (<- open res1)
> getChildren(CDOResource@OID26358) = 45 (<- open res1 again)
> getChildren(CDOResource@OID19749) = 18070 (<- open res3)
> getChildren(CDOResource@OID19749) = 9 (<- open res3 again)
> ------------------------------------------------------------
>
> as a first step: you are configuring the collection loading policy wrong. The first parameter is what should be fetched at once, so 0 is not a good idea if you want to preload your whole model.
>
> Therefore I used
> CDOCollectionLoadingPolicy policy = CDOUtil.createCollectionLoadingPolicy(10000, 10000);

Using partial collection loading at all looks like a bad idea if the purpose is to reduce the number of server round trips. It's really best not to call CDOSession.Options.setCollectionLoadingPolicy() in this case.


> instead of your
> CDOCollectionLoadingPolicy policy = CDOUtil.createCollectionLoadingPolicy(0, 10000);
>
> which lead to
>
> ------------------------------------------------------------
> initializing = 875
> getChildren(CDOResource@OID26358) = 12730
> getChildren(CDOResource@OID26358) = 52
> getChildren(CDOResource@OID19749) = 10366
> getChildren(CDOResource@OID19749) = 5
> ------------------------------------------------------------
>
> This is already a 50% speed-up.
>
>
> Next, you are configuring your revision prefetching policy with CDORevision.INFINITE_DEPTH (which is -1). Because of an if-statement in
> createRevisionPrefetchingPolicy, revision prefetching for negative values is deactivated. Therefore, you actually never used the revision prefetching policy. I have to clarify with Eike if CDORevision.INFINITE_DEPTH is actually not allowed here, maybe we should state this more explicitly in the documentation.
>
> Anyway, using
>
> transaction.options().setRevisionPrefetchingPolicy(CDOUtil.c reateRevisionPrefetchingPolicy(10));
> instead of your
>
> transaction.options().setRevisionPrefetchingPolicy(CDOUtil.c reateRevisionPrefetchingPolicy(CDORevision.INFINITE_DEPTH));

CDOUtil.createRevisionPrefetchingPolicy(int) could really need more documentation but the name of the parameter indicates a *size* and not a *depth*.


>
> in addition to the modified collection loading policy above leads to
>
> ------------------------------------------------------------
> initializing = 5473
> getChildren(CDOResource@OID26358) = 6655
> getChildren(CDOResource@OID26358) = 73
> getChildren(CDOResource@OID19749) = 6522
> getChildren(CDOResource@OID19749) = 10
> ------------------------------------------------------------
>
> which makes the initialization slower, but again boosts performance by 40-50%.
>
> I hear you asking the next question, why the first access is still slower than the second one. I cannot state why at this time. I have to do further analysis. Maybe its a bug either in the prefetching policy or in our understanding of how it should work :-)
>
> But finally, you wanted to preload your whole model in the client. You can do this quite simply by replacing the whole prefetching policy with one explicit call:
>
> transaction.getRootResource().cdoPrefetch(CDORevision.DEPTH_ INFINITE);

Yeah, that's exactly what I tried to explain repeatedly.


>
> (yes, CDORevision.DEPTH_INFINITE is actually allowed here ...)

This time the parameter name suggests a *depth* and not a *size* ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> this makes the initialization really slow, but leads to instant subsequent access as you wanted it:
>
> ------------------------------------------------------------
> initializing = 157339
> getChildren(CDOResource@OID26358) = 190
> getChildren(CDOResource@OID19749) = 121
> getChildren(CDOResource@OID26358) = 52
> getChildren(CDOResource@OID19749) = 6
> ------------------------------------------------------------
>
>
> I hope this analysis helps you a bit and you are invited to share your further experience with us by, for example, complementing http://wiki.eclipse.org/Tweaking_CDO_Performance with your insights.
> Obviously, there are some things not entirely clear in there.
>
>
> Have a nice weekend,
> Cheers,
> Stefan
>
>
>
>
>
>
>
> On 01.10.2010 17:46, Guillaume P. wrote:
>> Sorry for all my questions, but I'm on those problems since several
>> weeks now and I don't know where else I could find help. I understand
>> you cannot use all your time for making support, and I thank you for all
>> your help.
>>
>> So, here is http://dl.free.fr/vBvkgsg0L the zip file containing the full
>> plugin project. As told before, I cannot provide my big CDO model
>> (because of confidentiality rules), but I think you have one for your
>> tests. You just have to change the "host" and "repoName" constants in
>> the DBManager class to make the plugin reading your own repository.
>>
>> Hopping that nothing is missing, thanks you again for your help.
>>
>> Guillaume
>


Re: [CDO] bad performances for few objects [message #630706 is a reply to message #630562] Mon, 04 October 2010 16:07 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Hi !

Thank you both for your help.

Firstly I would like to tell to Eike that I had understood what you were telling me to do. As you can see in my third message, in the code example, I was already using the method cdoPrefetch(10000). But as it didn't seem to have any effect, I tried with the PrefetchingPolicy... without success.

Regarding the stefan's work (and thank you very much for the time you probably passed on it), I reproduced exactly the same process to correct progressively my own project code. But result aren't the same:

with my initial code (and resources generated with your code), results are:

------------------------------------------------------------
initialization = 703
getChildren(CDOResource@OID78051) = 6781
getChildren(CDOResource@OID78051) = 0
getChildren(CDOResource@OID84779) = 7406
getChildren(CDOResource@OID84779) = 0
------------------------------------------------------------

Setting 10000 as first parameter of CollectionPolicy does nothing on my side:

------------------------------------------------------------
initialization = 718
getChildren(CDOResource@OID78051) = 6907
getChildren(CDOResource@OID78051) = 0
getChildren(CDOResource@OID84779) = 7172
getChildren(CDOResource@OID84779) = 16
------------------------------------------------------------

So I tried to remove this line, as recommended Eike, but without change.

Changing the PrefetchPolicy to 10 gives about 50% speed-up:

------------------------------------------------------------
initialization = 687
getChildren(CDOResource@OID78051) = 2844
getChildren(CDOResource@OID78051) = 16
getChildren(CDOResource@OID84779) = 4079
getChildren(CDOResource@OID84779) = 0
------------------------------------------------------------

And at last, replacing the setPrefetchPolicy(...) line by the line " transaction.getRootResource().cdoPrefetch(CDORevision.DEPTH_ INFINITE);" provide those results:

------------------------------------------------------------
initialization = 672
getChildren(CDOResource@OID78051) = 6703
getChildren(CDOResource@OID78051) = 0
getChildren(CDOResource@OID84779) = 6985
getChildren(CDOResource@OID84779) = 16
------------------------------------------------------------


So, here I don't really understand... perhaps it's my server which is not correctly configured ?
The configuration file is in the project, at the path "server/configuration/cdo-server.xml".
My server run configuration contains those parameters:

Program arguments:
Quote:
-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console -debug


VM arguments:
Quote:
- -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m -Dnet4j.config=${resource_loc:/CDOExample/server/configurati on} -Dorg.osgi.service.http.port=8080 -Ddebug=true


My client run configuration (if needed) contains those parameters:

Program arguments:
Quote:
-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog


VM arguments:
Quote:
-Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m -XX:MaxPermSize=128m



Well, I'm blocked here, so I think I will try to explore other directions. But if you have any idea of the problem source, i am ready to try your solution.

Thank you very much for your time and your help,
Regards,

Guillaume
Re: [CDO] bad performances for few objects [message #631121 is a reply to message #630706] Wed, 06 October 2010 09:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 04.10.2010 18:07, schrieb Guillaume P.:
> Hi !
>
> Thank you both for your help.
>
> Firstly I would like to tell to Eike that I had understood what you were telling me to do. As you can see in my third message, in the code example, I was already using the method cdoPrefetch(10000).

Apologies, sometimes I try to spare some time by not reading through old posts for each new one in a thread ;-(

> But as it didn't seem to have any effect,

I may not have asked what version of CDO you're using. There was an enhancement to cdoPrefecth(), but only in 4.0. Please compare:

318919: Removing precondition for the prefetching to work effectively
https://bugs.eclipse.org/bugs/show_bug.cgi?id=318919

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



> I tried with the PrefetchingPolicy... without success.
>
> Regarding the stefan's work (and thank you very much for the time you probably passed on it), I reproduced exactly the same process to correct progressively my own project code. But result aren't the same:
>
> with my initial code (and resources generated with your code), results are:
>
> ------------------------------------------------------------
> initialization = 703
> getChildren(mailto:CDOResource@OID78051) = 6781
> getChildren(mailto:CDOResource@OID78051) = 0
> getChildren(mailto:CDOResource@OID84779) = 7406
> getChildren(mailto:CDOResource@OID84779) = 0
> ------------------------------------------------------------
>
> Setting 10000 as first parameter of CollectionPolicy does nothing on my side:
>
> ------------------------------------------------------------
> initialization = 718
> getChildren(mailto:CDOResource@OID78051) = 6907
> getChildren(mailto:CDOResource@OID78051) = 0
> getChildren(mailto:CDOResource@OID84779) = 7172
> getChildren(mailto:CDOResource@OID84779) = 16
> ------------------------------------------------------------
>
> So I tried to remove this line, as recommended Eike, but without change.
>
> Changing the PrefetchPolicy to 10 gives about 50% speed-up:
>
> ------------------------------------------------------------
> initialization = 687
> getChildren(mailto:CDOResource@OID78051) = 2844
> getChildren(mailto:CDOResource@OID78051) = 16
> getChildren(mailto:CDOResource@OID84779) = 4079
> getChildren(mailto:CDOResource@OID84779) = 0
> ------------------------------------------------------------
>
> And at last, replacing the setPrefetchPolicy(...) line by the line " transaction.getRootResource().cdoPrefetch(CDORevision.DEPTH_ INFINITE);" provide those results:
>
> ------------------------------------------------------------
> initialization = 672
> getChildren(mailto:CDOResource@OID78051) = 6703
> getChildren(mailto:CDOResource@OID78051) = 0
> getChildren(mailto:CDOResource@OID84779) = 6985
> getChildren(mailto:CDOResource@OID84779) = 16
> ------------------------------------------------------------
>
>
> So, here I don't really understand... perhaps it's my server which is not correctly configured ?
> The configuration file is in the project, at the path "server/configuration/cdo-server.xml".
> My server run configuration contains those parameters:
>
> Program arguments:
> Quote:
>> -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console -debug
>
>
> VM arguments:
> Quote:
>> - -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m -Dnet4j.config=${resource_loc:/CDOExample/server/configurati on} -Dorg.osgi.service.http.port=8080 -Ddebug=true
>
>
> My client run configuration (if needed) contains those parameters:
>
> Program arguments:
> Quote:
>> -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog
>
>
> VM arguments:
> Quote:
>> -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m -XX:MaxPermSize=128m
>
>
>
> Well, I'm blocked here, so I think I will try to explore other directions. But if you have any idea of the problem source, i am ready to try your solution.
>
> Thank you very much for your time and your help,
> Regards,
>
> Guillaume


Re: [CDO] bad performances for few objects [message #631664 is a reply to message #631121] Fri, 08 October 2010 12:18 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Hi Eike,

Yes, I'm not using the 4.0 version (the default update site gives me the 3.0 version).

I found in this document what seems to be the update site of the 4.0 version (https:// build.eclipse.org/hudson/job/emf-cdo-integration/lastSuccess fulBuild/artifact/result/site.p2)... but it is not responding. Is it no more valid ?

Regards,

Guillaume
Re: [CDO] bad performances for few objects [message #631674 is a reply to message #631664] Fri, 08 October 2010 12:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Hi Guillaume,

The webmasters have moved all builds to a new server: https://hudson.eclipse.org/hudson/job/emf-cdo-integration/la stSuccessfulBuild/artifact/result/site.p2

I've updated that wiki page.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 08.10.2010 14:18, schrieb Guillaume P.:
> Hi Eike,
>
> Yes, I'm not using the 4.0 version (the default update site gives me the 3.0 version).
>
> I found in http://wiki.eclipse.org/CDO_Hibernate_Store_Download_and_Ins tall#Download_locations what seems to be the update site of the 4.0 version ( https://build.eclipse.org/hudson/job/emf-cdo-integration/las tSuccessfulBuild/artifact/result/site.p2)... but it is not responding. Is it no more valid ?
>
> Regards,
>
> Guillaume


Re: [CDO] bad performances for few objects [message #632087 is a reply to message #631674] Mon, 11 October 2010 14:07 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Hum... It doesn't work either with the current 4.0 version.
But thank you for your time Smile

Regards,

Guillaume
Re: [CDO] bad performances for few objects [message #632094 is a reply to message #632087] Mon, 11 October 2010 14:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 11.10.2010 16:07, schrieb Guillaume P.:
> Hum... It doesn't work either with the current 4.0 version.
If you explain what exactly happens or not we can perhaps fix it.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] bad performances for few objects [message #632328 is a reply to message #632094] Tue, 12 October 2010 14:57 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Sorry, it was my fault on the last problem (my model had been corrupted just before trying the 4.0 version).

So the 3.0 CDO version was the problem: With the 4.0 everything is really faster now ! Smile

... But it still have a questions: what does exactly setPrefetch(1000) ? It looks like if it loads all the hierarchy in one time, while I thought it would load only asked sub-objects by packets of 1000.

Thank you very much for you help !

Guillaume
Re: [CDO] bad performances for few objects [message #632344 is a reply to message #632328] Tue, 12 October 2010 15:28 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 12.10.2010 16:57, schrieb Guillaume P.:
> Sorry, it was my fault on the last problem (my model had been corrupted just before trying the 4.0 version).
>
> So the 3.0 CDO version was the problem: With the 4.0 everything is really faster now ! :)
Good! ;-)

>
> ... But it still have a questions: what does exactly setPrefetch(1000) ?
You mean *cdo* Prefetch(...)?

That guy can prefetch the revisions for contained objects down to the specified containment *depth*.


> It looks like if it loads all the hierarchy in one time, while I thought it would load only asked sub-objects by packets of 1000.
Likely you're messing that up with the partial collection loading feature that allows to load the CDOIDs of a CDOList in kind of "packets".

>
> Thank you very much for you help !
You're welcome ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] bad performances for few objects [message #632356 is a reply to message #632344] Tue, 12 October 2010 16:22 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Yes you're right on the two points: I was speaking about cdoPrefetch(...), and I confused these methods since the beginning. Now everything is clear !

Just a last question: Currently, the CDO server is on the same PC as my client. Will the loading be faster if I use the offline mode ?
I mean: is the connection with the local repository optimized (not using a localhost connection) ? Or is it the same connection as with the repository on the CDO server ?

Thank you again.
Regards,

Guillaume
Re: [CDO] bad performances for few objects [message #632367 is a reply to message #632356] Tue, 12 October 2010 16:30 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 12.10.2010 18:22, schrieb Guillaume P.:
> Yes you're right on the two points: I was speaking about cdoPrefetch(...), and I confused these methods since the beginning. Now everything is clear !
>
> Just a last question: Currently, the CDO server is on the same PC as my client. Will the loading be faster if I use the offline mode ?
> I mean: is the connection with the local repository optimized (not using a localhost connection) ?
Yes, usually you'd use a JCMConnector then. But you can already do that with a normal repository. No need to entertain an offline clone repository for that purpose.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] bad performances for few objects [message #632370 is a reply to message #632367] Tue, 12 October 2010 17:06 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
Yes but the project on which I am working needs and offline mode (That's one of the reason for what I am interested by CDO).
Currently I make my tests on a single machine, and I use a TCPConnector with a localhost connection, but the goal is to have the repository on a remote server, with several clients, offline mode, concurrent accesses, advances search features (I'm trying EMF Query), ...

Are you speaking about JVMConnector ? Is there any example for the use of this connector (especially for the server configuration and the server description) ?

Best regards,
Guillaume

[Updated on: Tue, 12 October 2010 17:12]

Report message to a moderator

Re: [CDO] bad performances for few objects [message #632376 is a reply to message #632370] Tue, 12 October 2010 17:30 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 12.10.2010 19:06, schrieb Guillaume P.:
> Yes but the project on which I am working needs and offline mode (That's one of the reason for what I am interested by CDO).
Maybe you should monitor my current work in progress:

327405: Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405

> Currently I make my tests on a single machine, and I use a TCPConnector with a localhost connection,
You should use the somewhat quicker JVMConnector.

> but the goal is to have the repository on a remote server, with several clients,
Then you'd need the TCPConnector.

> offline mode
Then you'd need an OfflineClone repository (with offline history and ability to serve multiple clients) or the leaner CDOWorkspace (see above).

> , concurrent accesses,
That's always included.

> advances search features (I'm trying EMF Query), ...
OCL is advanced :P

See 256931: Provide common query language (OCL)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256931

>
> Are you speaking about JVMConnector ?
I guess so ;-)

> Is there any example for the use of this connector ?
One is org.gastro.server.internal.web.GastroServlet.init().

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] bad performances for few objects [message #633137 is a reply to message #632376] Fri, 15 October 2010 13:39 Go to previous messageGo to next message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
>> Yes but the project on which I am working needs and offline mode (That's one of the reason for what I am interested by CDO).
> Maybe you should monitor my current work in progress:
>
> 327405: Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
It's interesting, but I prefer the local repository system, which still giving us immediate feed back about remote modifications (when connected).

>> advances search features (I'm trying EMF Query), ...
> OCL is advanced Razz
>
> See 256931: Provide common query language (OCL)
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=256931
Hum... OCL is a little complicated for a final user (It would be interesting for me to allow user typing himself "complex" queries)... what about the SQL language like ?

>> Are you speaking about JVMConnector ?
> I guess so Wink
>
>> Is there any example for the use of this connector ?
> One is org.gastro.server.internal.web.GastroServlet.init().
Hum, I have a problem when opening a session with this configuration. I get this error:

Quote:
org.eclipse.net4j.channel.ChannelException: org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found: org.eclipse.net4j.serverProtocols[cdo]
at org.eclipse.net4j.internal.jvm.JVMConnector.registerChannelW ithPeer(JVMConnector.java:115)
at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:156)
at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:1)
at org.eclipse.net4j.signal.SignalProtocol.open(SignalProtocol. java:130)
at org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl.initP rotocol(CDONet4jSessionImpl.java:166)
at org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl.activ ateSession(CDONet4jSessionImpl.java:92)
at org.eclipse.emf.internal.cdo.session.CDOSessionImpl.doActiva te(CDOSessionImpl.java:1174)
at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycl e.java:72)
at org.eclipse.emf.internal.cdo.session.CDOSessionConfiguration Impl.openSession(CDOSessionConfigurationImpl.java:214)
at org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurat ionImpl.openSession(CDONet4jSessionConfigurationImpl.java:91 )


Searching on the forum gave me this thread (http://www.eclipse.org/forums/index.php?t=msg&th=136803 &start=0&S=4790720698f5e69bda0b9624bb06c28f), but no dependency seems to be missing for me. Here is what I have:

Quote:
org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.core.runtime;bundle-version="3.6.0",
org.eclipse.ui.ide;bundle-version="3.6.0",
org.h2;bundle-version="1.1.117",
org.eclipse.emf.query;bundle-version="1.2.100",
org.eclipse.jgit;bundle-version="0.8.4",
org.eclipse.net4j.tcp;bundle-version="4.0.0",
org.eclipse.net4j.jvm;bundle-version="4.0.0",
org.eclipse.net4j.db.h2;bundle-version="4.0.0",
org.eclipse.emf.cdo.server.db;bundle-version="4.0.0",
org.eclipse.emf.cdo.ui.ide;bundle-version="4.0.0",
org.eclipse.emf.cdo.net4j;bundle-version="4.0.0",
org.eclipse.emf.cdo.server.net4j;bundle-version="4.0.0"


Maybe I should put this problem in the other thread to be more clear ^^

Best regards,
Guillaume
Re: [CDO] bad performances for few objects [message #633295 is a reply to message #633137] Sat, 16 October 2010 05:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 15.10.2010 15:39, schrieb Guillaume P.:
>>> Yes but the project on which I am working needs and offline mode (That's one of the reason for what I am interested by CDO).
>> Maybe you should monitor my current work in progress:
>>
>> 327405: Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
> It's interesting, but I prefer the local repository system, which still giving us immediate feed back about remote modifications (when connected).
>
>>> advances search features (I'm trying EMF Query), ...
>> OCL is advanced :p
>>
>> See 256931: Provide common query language (OCL)
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=256931
> Hum... OCL is a little complicated for a final user (It would be interesting for me to allow user typing himself "complex" queries)... what about the SQL language like ?
From a CDO perpective it's almost trivial to hook your own IQueryHandlers into a repository. Please look at the existing implementations of this interface for examples. You may want to checkout the complete sources: http://wiki.eclipse.org/CDO_Source_Installation

>
>>> Are you speaking about JVMConnector ?
>> I guess so ;)
>>
>>> Is there any example for the use of this connector ?
>> One is org.gastro.server.internal.web.GastroServlet.init().
> Hum, I have a problem when opening a session with this configuration. I get this error:
>
> Quote:
>> org.eclipse.net4j.channel.ChannelException: org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found: org.eclipse.net4j.serverProtocols[cdo]
>> at org.eclipse.net4j.internal.jvm.JVMConnector.registerChannelW ithPeer(JVMConnector.java:115)
>> at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:156)
>> at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:1)
>> at org.eclipse.net4j.signal.SignalProtocol.open(SignalProtocol. java:130)
>> at org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl.initP rotocol(CDONet4jSessionImpl.java:166)
>> at org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl.activ ateSession(CDONet4jSessionImpl.java:92)
>> at org.eclipse.emf.internal.cdo.session.CDOSessionImpl.doActiva te(CDOSessionImpl.java:1174)
>> at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycl e.java:72)
>> at org.eclipse.emf.internal.cdo.session.CDOSessionConfiguration Impl.openSession(CDOSessionConfigurationImpl.java:214)
>> at org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurat ionImpl.openSession(CDONet4jSessionConfigurationImpl.java:91 )
>
>
> Searching on the forum gave me http://www.eclipse.org/forums/index.php?t=msg&th=136803& amp;start=0&S=4790720698f5e69bda0b9624bb06c28f, but no dependency seems to be missing for me.
Are you running standalone? Then you may need to call CDONet4jServerUtil.prepareContainer(IPluginContainer.INSTANC E) to mimic what the extension registry does when running in OSGi. Does that help?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> Here is what I have:
>
> Quote:
>> org.eclipse.ui;bundle-version="3.6.0",
>> org.eclipse.core.runtime;bundle-version="3.6.0",
>> org.eclipse.ui.ide;bundle-version="3.6.0",
>> org.h2;bundle-version="1.1.117",
>> org.eclipse.emf.query;bundle-version="1.2.100",
>> org.eclipse.jgit;bundle-version="0.8.4",
>> org.eclipse.net4j.tcp;bundle-version="4.0.0",
>> org.eclipse.net4j.jvm;bundle-version="4.0.0",
>> org.eclipse.net4j.db.h2;bundle-version="4.0.0",
>> org.eclipse.emf.cdo.server.db;bundle-version="4.0.0",
>> org.eclipse.emf.cdo.ui.ide;bundle-version="4.0.0",
>> org.eclipse.emf.cdo.net4j;bundle-version="4.0.0",
>> org.eclipse.emf.cdo.server.net4j;bundle-version="4.0.0"
>
>
> Maybe I should put this problem in the other thread to be more clear ^^
>
> Best regards,
> Guillaume


Re: [CDO] bad performances for few objects [message #636649 is a reply to message #633295] Tue, 02 November 2010 10:51 Go to previous message
Guillaume P. is currently offline Guillaume P.Friend
Messages: 69
Registered: June 2010
Location: Toulouse, France
Member
> Are you running standalone? Then you may need to call CDONet4jServerUtil.prepareContainer(IPluginContainer.INSTANC E) to mimic what the extension registry does when running in OSGi. Does that help?

I apologize for the wait... Calling CDONet4jServerUtil.prepareContainer(...) on my container resolved the problem. Thank you.
I still have some problems, but it's about the offline mode, so I'll continue on the other thread I had launched about this subject Smile

Regard,

Guillaume
Previous Topic:EMap<String, EList<MyObject>>
Next Topic:[Teneo] PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH and @Table or @Column
Goto Forum:
  


Current Time: Wed Oct 16 04:39:21 GMT 2019

Powered by FUDForum. Page generated in 0.04063 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top