Book a Demo

Author Topic: Performance issues (memory & speed) with Java  (Read 3797 times)

paphko

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Performance issues (memory & speed) with Java
« on: May 08, 2007, 11:22:17 pm »
Hi out there,

I'm using the Java API to connect to the Enterprise Architect's COM automation interface using the files shipped with EA v6.5. Technically, that works fine. :D

But accessing the EA is quite slow. If I try to read only 3 packages, 15 classes and some tagged values, it takes almost half a minute. Actually, I want to read a model with 1000+ classes which takes about 15 minutes :o
Is there any way speedup the access?

It seems even worse if I create new elements. In a small test I created 100 packages each containing 100 classes. This took almost 10min..  :(

My goal is to read the entire model (1000+ classes) in java, modify it and write it back into EA. Unfortunately, after 8h an out of memory error occured in EA -> I checked the memomry usage and EA was using 1.5 GB !! :o

The readme of the Java API says: "Native COM classes and memory allocated for these is not seen by the Java garbage collector, so you should explicitly invoke a garbage collection from time to time when working with many objects using the Java API."
This is what I did, but obviously it doesn't affect the EA?!

Any help appreciated!

Patrick
« Last Edit: May 09, 2007, 03:09:04 am by paphko »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Performance issues (memory & speed) with J
« Reply #1 on: May 09, 2007, 01:08:31 pm »
The problem with the memory is that Java memory collection will never1 Finalize the Java classes.  This in turn stops COM from cleaning up the COM objects behind those classes because they are referenced by a Java class.  To force Java to release the memory you need to call
System.gc() followed by System.runFinalization().  (This has been provided as a single call in Repository.Compact().)

I think the problems with speed are the same as faced by any users of the automation interface and includes a large constant time for start up of EA, and then loading each of element used or written.  Have a look at the help file for Repository.BatchAppend and Repository.EnableCache.  Setting these when appropriate will make a big difference to speed.

1. At least in practical terms.  If you're interested and haven't tried reverse engineering the Jar file into EA.  It's because they only contain a single long value (the memory address of the corresponding COM object) and Java decides that it isn't worth freeing.

paphko

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: Performance issues (memory & speed) with J
« Reply #2 on: May 10, 2007, 10:43:37 pm »
Thanks for the quick reply.
Unfortunately, I cannot get the BatchAppend property to work. I tried to set it to true, then I created 100 packages each containing 100 classes again. Afterwards, I set batchAppend to false. But there is no big difference in time???