Today I want to share with you my last challenge with a customer that had a pretty ennoying issue: XaaS forms would take over 40 seconds to load in vRealize Automation:
As a reminder, vRealize Automation allows admins to publish an orchestrator workflow in order to provide anything as a service :). There are many benefits of using XaaS in vRealize Automation:
- Its vRO workflows behind and vRO can do everything
- Forms highly customizable with Textfield, Checkbox, List, Calendar, Slider, Picture…
- Conditional Logic to dynamically display or hide fields based on values from another field
- Fields can load data from external sources
The problem with this XaaS form above (which deploys Redhat VM) is that lists (1.Trigram, 2.Environment, 3.Region and 4.Network) are populated from a SQL db after many conditional computations. All lists depends on the previous lists inputs, so when 1 is updated, it updates 2, 3 and 4. But when 2 is updated it updates 3 and 4, and 3 updates 4. In this form, the 4 lists don’t trigger 4 SQL requests but 10. What I also observed is that the same combination of inputs is used most of the time. This customer has also thousands of users using this form.
So the question is: what to do when an application is intensively executing the same expensive requests? Answer: Take advantage of data caching.
This does not exists in VRO so I needed to create a plugin. I started testing Java caching libs and I chose JCS (Java Caching System) which is a powerful distributed caching system developped by Apache. Then I created Java classes to be easily used in VRO and here it is:
Back to our XaaS form which takes too long to load. In orchestrator I had to modify the way lists are loading their content:
- Instead of executing a SQL request and do computation, I check the cache first to see if the content is present.
- If the data is not in the cache, it executes the SQL request, and store the data in the cache with an expiration time
- If the data is in the cache but expired, data is automatically removed from cache
Here is the action that populates the list of networks based on the values selected in other lists:
After implementing the plugin and modifying actions called by the XaaS form, the loading time jump from 40 seconds to 4 seconds!
This caching plugin can store any kind of VRO object and can be used everytime you need to reduce latency times when executing the same expensing requests against an external system.
Download link: https://sourceforge.net/p/vro-caching-system