Author Topic: Automation API Performance When Using a Cloud Server  (Read 76 times)

boonoboo

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Automation API Performance When Using a Cloud Server
« on: November 28, 2017, 11:05:43 pm »
I apologize in advance if this question has already been answered. I skimmed the first pages of the board, but did not find any similar post.

Our team has developed a series of scripts for modifying the tagged values of elements, packages, attributes and connector ends, as well as an add-in to simplify modifying tagged values with specific names. Both the scripts and add-in use the Automation API to access the objects through the Repository. As an example, the tagged values of a selected element is accessed by using the function Repository.GetContextObject() to retrieve the currently selected object, then accessing the attribute .TaggedValues using the reference to the object.

While this works well when working with a locally stored .eap-file, performance drops greatly when working with a Cloud-based repository. I've carried out a little testing, and while I'm hesitant to jump to a conclusion, I believe the problem may be due to bandwidth issues, i.e. the script / add-in transferring a large amount of data when the script script is run / the add-in window is called, which becomes a bottleneck.

Does anyone have any similar experience or insight regarding this subject?

Both the script and add-in only modify objects using the Automation API. I've considered using the Repository.Execute() and Repository.SQLQuery() function to ensure that objects are only retrieved and updated once, but would prefer not using this method due to the risks of using homemade SQL statements.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7747
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automation API Performance When Using a Cloud Server
« Reply #1 on: November 28, 2017, 11:15:28 pm »
I've seen a similar complaint recently.

I can imagine that this could indeed be an issue.
It is not 100% clear to me as why exactly that would be a problem in a cloud server configuration though.

Using the EA client surely uses about as much data and queries to the backend as scripts or add-ins no?

Anyway, in any case (cloud or not) it is advisable to
- Make sure you only retrieve an API object once. Keep a local cache if needed (and you are sure the objects are not changed in between reads)
- Be wary of EA.Collections. These are not collections as you know them from .Net or other libraries. Iterating an EA.Collection can be very costly. Some of them, depending on the type of object stored in the collection, go back to the database at each getNext(). So if at all possible use an SQL query to get the ID of what you need and then use the direct getXXXByID() type operations to get the API object you need. If using an EA.Collection cannot be avoided then make sure you only iterate it once, and store the objects in a "regular" collection type.

Geert