Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Background


In many data analysis projects, performance is most likely the last thing to check, but very often it soon becomes an urgent issue to address before the project can go live. In this blog, I would like to share a step-by-step guide I have been using to help customers remove some blockers for their projects. It is not a very comprehensive guide yet, but I feel it is worth spreading the idea if it could give you some insights into your project.

Steps


Normally, performance issues happen in two scenarios: the initial loading of the analytic application and user interactions (usually filtering). We can use following steps to address these concerns. I categorize these steps into different tiers by benefits versus efforts.

Tier 1


Step 1. Set Pause Data Refresh for all the charts and tables unnecessary at the startup.

For instance, charts and tables on a popup or tab trip’s inactive tabs should be set to Pause Data Refresh on the Builder panel.


Then you can start the data refresh on the fly by script API, for instance, before a popup opens.
if (Chart_1.getDataSource().isRefreshPaused()) {

Chart_1.getDataSource().setRefreshPaused(false);
}

 

Step 2. Load Invisible widgets in the background.

Open the Analytic Application Settings dialog:


Then, select Load invisible widgets in the background:


Step 3. Use Always initialize on startup when accessing an invisible widget in onInitialization event.

Try to avoid accessing an invisible widget in the onInitialization event, but if you must do so, check Always initialize on startup on the Styling panel of the widget.


Note: If the widget is part of an invisible container, select Always initialize on startup for the container as well.

Step 4. Use Analytic Application Script Performance Popup

It is my favorite tool in Q3 2021 Release. It visualizes the duration of your script execution and operations that negatively influence script execution performance.


To enable the Analytic Application Script Performance Popup, insert the URL parameter

?APP_PERFORMANCE_LOGGING=true right after the .html part in your analytic application’s URL.

Example:

https://www.example.com/.../app.html?APP_PERFORMANCE_LOGGING=true#... /DBE810069927EEBD227B89F91B977AD5/?mode=view

To open the Analytic Application Script Performance Popup, press SHIFT+CTRL+A /or SHIFT+CTRL+Z when running your analytic application.

Tip: I find it helpful to run this tool repeatedly with the divide-and-conquer approach. Firstly, comment out all the scripts in the onInitialization event, then run the tool to identify bottleneck and fix it. Then bring back some scripts, run the tool and fix. Do this repeatedly until you bring back all the scripts and clear up critical bottlenecks indicated in the tool.

The end of Tier 1 steps: my experience is that I usually spend 4 – 6 hours on the Tier 1 steps, depending on the complexity of the analytic applications. After the completion of these steps, I usually see 30% or even more performance improvements in analytic applications.

Tier 2


Step 5. Apply additional performance best practices from Developer Handbook and blogs.

They provide a more comprehensive view and detailed tips on performance improvement.

Developer Handbook: link

Blogs: link

I would like to highlight the following tip because it relates to many customers’ use cases, and the benefit is very noticeable in the filtering scenario. For instance, I have seen one customer has improved 60% of their filtering performance in application because a lot of roundtrips have been reduced.
//If you use the method setDimensionFilter() of a data source and 
//pass only a member ID, then a roundtrip to the backend is performed
//to fetch the member’s description:

var memberId = Dropdown_1.getSelectedKey();
Table_1.getDataSource().setDimensionFilter("sap.epm:Department", memberId);

// Roundtrip performed to fetch member description

//When you pass a MemberInfo object (it contains a description) instead of
//a member ID string, then no roundtrip to the backend is performed:


var memberId = Dropdown_1.getSelectedKey();
var memberDescription = Dropdown_1.getSelectedText();
Table_1.getDataSource().setDimensionFilter("sap.epm:Department",
{id: memberId, description: memberDescription});

// No roundtrip performed to fetch member description. It's already present.

 

Tier 3


Step 6. Simply the UI design and workflow of your application if possible.

It is not necessarily the last step. Once you get more and more familiar with the performance best practices, you will be able to optimize the application design from the start.

The End


Performance tuning is not an easy job but a meaningful one because the analytic applications we built add value only when the business users can use them with satisfactory experience. I hope my step-by-step guide could offer you some inspiration for your project. I am looking forward to your feedback and best practices as well because with collective wisdom we could make the performance tuning job easier.

 

Appendix

The following tip is not included in the overall step-by-step guide, but sometimes helpful to identify performance bottlenecks.

Using Google Chrome’s Developer tools, you can find which requests are pending. And by sorting by time, you can see which requests cost too much time.


 

2 Comments
pooja_elangovan
Explorer
0 Kudos
Really such a wonderful and such a beginner-friendly blog.

Thanks.
rpuranik
Participant
0 Kudos
Jason, Thank you so much for this amazing blog!!

Question: To start the data refresh on the fly by script API, for instance, before a popup opens, where do you write this script? under Canvas OnInilization? I added this here and the popup still takes a while to load the table chart. I set the pause refresh on the table in the builder panel. I also have set the drill imitation on the table to 500 rows.

Please help! Thank you

P.S. I am very new to scripting.