Monday, August 29, 2016

Gel Script Performance - CA PPM - Avoid Excessive use of the Core:Set

In complex GEL scripts that build XOG XML from SQL query output, avoid excessive use of the <core:set> tag for performance reasons. This tag use JAVA mbeans for variable storage. Multiple GEL scripts using frequent <core:set> calls will result in significant synchronization performance hit.Instead of using <core:set>, consider using a native Java Object such as a Hash map to store local variables insider tight loops.

Native Hashmap example:

<-Create a HashMap instance -->

<Core:new className="java.util.HashMap" var="myHash"/>

<-Place some values in this hashMap from a previous query -->


<core:invoke on="${myHash}" method="put" >

<core:arg value="projectid" >
<core:arg value="${myQuery.rows[0].ID}" />

</core:invoke >


<core:invoke on="${myHash}" method="put" >

<core:arg value="projectName" >
<core:arg value="${myQuery.rows[0].NAME}" />

</core:invoke >

<-Log this value -->

<gel:log level="info">Processing project ${myHash.get('NAME')}</gel:log>