Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Performance issues while migrating to java 11 ?
[CDO] Performance issues while migrating to java 11 ? [message #1853388] Thu, 30 June 2022 09:42 Go to next message
Cyril Chevé is currently offline Cyril ChevéFriend
Messages: 14
Registered: October 2016
Junior Member
Hello,

I was using CDO 4.6 with java 8.
I am trying to migrate to CDO 4.13 with java 11 (eclipse 2021-03) but I have performance issues.

For example, I have made a test with a very simple model (CDO native):
The model:
* object1
* object2
references[0..*] to object1 (containment=false, ordered=true, resolve proxies=true, unique=true)

The test:
adding 5000 object1 in the list "references" of one object2 and mesuring only the time of "add" call

The results:
* java 8: around 80ms
* java 11: around 120ms

Analysis:
I have determined that the delay for this test was due to the loop about the proxy resolution in "DelegatingEcoreEList.contains()" method (in org.eclipse.emf.ecore plugin). But I don't find why the delegateGet method takes more time in java 11.

In a second test with changing the "resolve proxies" parameter to false, I get the same time in java 8 and java 11: around 80ms.

These were just tests and don't completely correspond to my use case but the performance delay for my use case seems to be in the same order of magnitude.
Has anyone got the same kind of performance issues while migrating to java 11 (or greater) ?

Thanks in advance.

Cyril
Re: [CDO] Performance issues while migrating to java 11 ? [message #1853400 is a reply to message #1853388] Thu, 30 June 2022 13:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Cyril,

As you have not shared your test code, I had to write my own:

    Supplier supplier = getModel1Factory().createSupplier();
    InternalEList<PurchaseOrder> target = (InternalEList<PurchaseOrder>)supplier.getPurchaseOrders();

    List<PurchaseOrder> source = new ArrayList<>();
    for (int i = 0; i < 5000; i++)
    {
      source.add(getModel1Factory().createPurchaseOrder());
    }

    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();
    CDOResource resource = transaction.createResource(getResourcePath("/test1"));
    resource.getContents().add(supplier);

    System.out.println("target.add(purchaseOrder);");
    for (int i = 0; i < 10; i++)
    {
      target.clear();
      long nanos = 0;

      for (PurchaseOrder purchaseOrder : source)
      {
        long start = System.nanoTime();
        target.add(purchaseOrder);
        long end = System.nanoTime();

        nanos += end - start;
      }

      System.out.println(TimeUnit.MILLISECONDS.convert(Duration.ofNanos(nanos)) + " ms");
    }

    System.out.println("target.addUnique(purchaseOrder);");
    for (int i = 0; i < 10; i++)
    {
      target.clear();
      long nanos = 0;

      for (PurchaseOrder purchaseOrder : source)
      {
        long start = System.nanoTime();
        target.addUnique(purchaseOrder);
        long end = System.nanoTime();

        nanos += end - start;
      }

      System.out.println(TimeUnit.MILLISECONDS.convert(Duration.ofNanos(nanos)) + " ms");
    }


By default our Supplier.getPurchaseOrders() list ist generated with "Resolve Proxies = true". So the test repeatedly outputs this on my own laptop:

target.add(purchaseOrder);
22 ms
11 ms
9 ms
6 ms
7 ms
6 ms
6 ms
4 ms
4 ms
4 ms
target.addUnique(purchaseOrder);
2 ms
2 ms
2 ms
1 ms
1 ms
1 ms
1 ms
1 ms
1 ms
1 ms


As we can expect, there is a considerable "warm-up" effect. As you can also see, there is quite a big advantage in using InternalEList.addUnique() over EList.add().

Then I changed the model and generated the Supplier.getPurchaseOrders() list ist generated with "Resolve Proxies = false". Here are the results:

target.add(purchaseOrder);
21 ms
11 ms
8 ms
7 ms
7 ms
6 ms
4 ms
4 ms
4 ms
3 ms
target.add(purchaseOrder);
2 ms
2 ms
2 ms
2 ms
2 ms
1 ms
1 ms
1 ms
1 ms
1 ms


So, I would establish the value of "Resolve Proxies" does not make a noticeable difference.


Re: [CDO] Performance issues while migrating to java 11 ? [message #1853402 is a reply to message #1853400] Thu, 30 June 2022 13:36 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
I also tried out what difference it makes when the source objects are not in state TRANSIENT, but in state NEW, so I changed the initial part of the test:

    Company company = getModel1Factory().createCompany();
    EList<PurchaseOrder> source = company.getPurchaseOrders();

    for (int i = 0; i < 5000; i++)
    {
      source.add(getModel1Factory().createPurchaseOrder());
    }

    Supplier supplier = getModel1Factory().createSupplier();
    company.getSuppliers().add(supplier);
    InternalEList<PurchaseOrder> target = (InternalEList<PurchaseOrder>)supplier.getPurchaseOrders();

    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();
    CDOResource resource = transaction.createResource(getResourcePath("/test1"));
    resource.getContents().add(company);

    if (false)
    {
      transaction.commit();
    }


The times are slightly bigger:

target.add(purchaseOrder);
30 ms
14 ms
12 ms
10 ms
9 ms
8 ms
8 ms
9 ms
8 ms
8 ms
8 ms
8 ms
8 ms
7 ms
6 ms
6 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
target.addUnique(purchaseOrder);
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
3 ms
4 ms
4 ms
4 ms


And I tried with the source objects being in state CLEAN by enabling the commit() call:

target.add(purchaseOrder);
30 ms
14 ms
12 ms
10 ms
9 ms
8 ms
8 ms
9 ms
8 ms
8 ms
8 ms
8 ms
8 ms
7 ms
6 ms
6 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
5 ms
target.addUnique(purchaseOrder);
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
4 ms
3 ms
4 ms
4 ms
4 ms


No difference in the end...


Re: [CDO] Performance issues while migrating to java 11 ? [message #1854004 is a reply to message #1853402] Wed, 27 July 2022 13:17 Go to previous messageGo to next message
Cyril Chevé is currently offline Cyril ChevéFriend
Messages: 14
Registered: October 2016
Junior Member
Hello,

Sorry for the late answer.

I have found how to solve my performance issues.
In fact, it seems to come from the JDK itself, used to execute the application.
I was using jdk from temurin.
When I use jdk from Oracle, I get the same result with java 8 and java 11.

Regards,

Cyril
Re: [CDO] Performance issues while migrating to java 11 ? [message #1854017 is a reply to message #1854004] Thu, 28 July 2022 06:28 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
That is interesting and odd at the same time. Thanks for the feedback!

Previous Topic:Problems with adding new child during the creation of a model instance
Next Topic:EMF.edit gestString multiple editors & cross references
Goto Forum:
  


Current Time: Fri Apr 26 03:12:55 GMT 2024

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

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

Back to the top