Design Studio: Parallel Processing and Scripting
Getting started with parallel processing is easy. Assign data sources to processing groups, set “Merge Prompts” to false, and just execute the application. 🙂
While this is true in general, there are some things you need to know.
Parallel processing is not present in all phases of application execution. Four specific phases take advantage of parallel processing (see also Chapter 29.10 of Design Studio’s “Application Designer Guide”):
- Initialization of data sources on start-up
- Fetching result sets during rendering
- Submitting variables
- Data binding
As you might have noticed, the execution of script statements is not mentioned in the above list.
Beware the Script Execution
Design Studio scripts are always executed sequentially, that is statement by statement. When one statement is executed, it must rely on the fact that the execution of the previous statement has been completed. This rules out parallel execution of statements. For example, if a statement makes a decision based on a result that was computed with a previous statement, the script must be processed in the defined sequence in order to arrive at a reproducible result.
var value = LISTBOX_1.getSelectedValue();
if (value == “DeleteOrder”) {
// …
}
Keep this in mind when using script functions that access data sources.
But there is no need to worry, there are solutions around that deal with these circumstances.
Solution 1: Load Multiple Data Sources in Parallel During Script Execution
When you are initializing several data sources in a Design Studio script, try to centralize data source initialization in one place and use APPLICATION.loadDataSources(). This function can initialize the given data sources in parallel.
Traditionally initializing several data sources needed multiple script statements:
DS_1.loadDataSource();
DS_2.loadDataSource();
DS_3.loadDataSource();
As mentioned above these three statements would be executed in sequence. However the initialization of several data sources is a quite common scenario. Therefore a new statement is available that allows parallelization for this scenario:
APPLICATION.loadDataSources([DS_1, DS_2, DS_3]);
Note that this statement does not process all data sources in parallel, but according to their assignment to a processing group.
Solution 2: Use Property Binding
Property binding allows replacing sequential script statements with binding information of data sources to properties of components. The processing of property bindings takes part in the parallel processing.
Disclaimer: The usage of “Formatter Functions” imposed a significant performance overhead on property bindings in older versions of Design Studio. As of version 1.6 SP4 this overhead has been removed.
Property Binding – Simple Values
You want to set a text from a data source cell to a text field. Traditionally, a Design Studio script statement would retrieve the value of the cell with “getDataAsString” and assign it to the text property:
var text = DS_1.getDataAsStringExt(“store_sales”, {});
TEXT_1.setText(text);
When using property binding you create a property binding of type “Data Cell Binding” for the Text property of the text field:
Property Binding – Multiple Values
You want to populate a list box with members from a data source. Traditionally, a Design Studio script statement would retrieve the members with “getMembers” and assign it to the list box:
var items = DS_1.getMemberList(“city”, …);
LISTBOX_1.setItems(items);
When using property binding you create a property binding of type “Dimension Members Binding” for the Items property of the list box:
Summary
Script statements are always executed in sequence. Use property bindings and “loadDataSources()” to leverage the full potential of parallel processing. These can replace specific script statements with techniques that are executed in parallel.
just a link.. form more technical information on this topic, refer to Design Studio 1.5: View on Parallel Data Source Execution.
Thank you Martin, current article answered all my puzzles regarding how to utilize "parallel processing" in scripting.
Hi Martin,
Thanks for the explanation. I tried to follow your advice to use data binding, hoping that I can utilize parallel processing on startup.
However, I cannot make it work as I expected.
When I use data binding, its process time adds on top of parallel processing even I assign those datasource with different processing group.
What did I miss?
Thank you!
Best regards,
Alfred
Looking at your screenshot I assume you are using Dimension Member Binding for filling a listbox or similar component. Unfortunately Dimension Member Bindings will not be processed in parallel before Design Studio 1.6 SP 1. See SAP Note 2256207.
Hi,
unfoirtunately the statement APPLICATION.loadDataSources() is not available anymore in DS 1.6. do you know how to is replace it ?
Hi Baudouin,
the "loadDataSources" API is still available in 1.6.
If it does not work for you then please, then please open a bug ticket.
Regards, Martin
Yep, I find it indeed.
thx anyway for your answer.
Hi Martin,
I have Lumira server 2.3 SP2 PATCH3 and Lumira designer client Release 2.3 SP2 Patch 3 (Version: 23.2.3)
When I execute lumira dashboard first time, we have bad performance. &PROFILING=X report shows, that almost all time is spend on validation script (32116 ms: ScriptInterpreter: Validate script).
Could you help me, can I turn off validation script to improve performance?
Thanks in advance!
Hi Vitaliy,
when a dashboard is deployed on the server, the validation is executed when the first users starts the dashboard the very first time. All other starts of the dashboard, no matter which user, will not validate again.
When starting the dashboard on a local machine, within Lumira Designer, the dashboard scripting is validated every time. This can be disabled, by adding this line at the end of “SapLumiraDesigner.ini”:
The file “SapLumiraDesigner.ini” is located in the installation directory of Lumira Designer (usually in “C:\Program Files\SAP Lumira\Lumira Designer”)
Best regards
Martin