Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

APJ-SAP Analytics Cloud - Application Designer

Performance Best Practices


Sep, 2021

PUBLIC
INTERNAL
Agenda

• Best Practices

• Demo

• Summary

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 2


Best Practices
Best Practices
SAC Client (Browser)

SAC Shell

Appliction Container
Please first consider:
▪ Loading invisible widgets in Background R
Script Runtime

Story Container
▪ Use the Pause Refresh API R

▪ Enable Planning for Tables only when planning is used Widget


Widget
R
Widget Script
Widget Script
APIs
APIs

▪ Use member info object with setDimensionFilter()


R

Then consider: Data Access

▪ The Design of the Applications


▪ Analytics Designer Script APIs
▪ Widgets Backends

▪ Other Considerations SAP Analytics


SAP HANA SAP BW
Cloud

Based on Story architecture, adding script runtime and APIs

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 4


Loading invisible widgets in background 1)

▪ All the invisible artifacts are loaded in background


automatically
▪ Scripts related to initial invisible widgets
▪ Widgets or containers defined within the invisible
containers
▪ Invisible tab strips

▪ Significantly speed up the application initialization


time if
▪ Application are divided into different pages/tab strips
▪ Less widgets are available on the first page or tab strip

▪ You can set application to be loaded in


background via
▪ Analytic application setting dialog
▪ Application URL parameter:
loadInvisibleWidgets=inBackground

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 5


Loading invisible widgets in background 2)
Application startup
With Load invisible widgets in background enabled

▪ Keep the scripts for Application startup


User Interaction Analytic Application Script Execution

onInitialization event as With Load invisible widgets in background disabled

less as possible Load


Application
User Interaction Analytic Application Script Execution
▪ Try not to access invisible
Initialize

widgets for onInitialization visible widgets

Load
event Application

▪ If you really need to Initialize all


widgets
Initialize
Execute
invisible
onInitialization
access the invisible widgets

widgets: Execute no
Widget already loaded

yes
onInitialization
▪ Set the widgets to Initialize

“Always initialize on
widget Assuming a widget
Update was changed during
widgets if onInitialization event

startup” necessary Assuming a widget


was changed during
onInitialization event Update widget

▪ Don’t nest the invisible


widgets too deep into
container structure.
Default mode Loading invisible widgets in background

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 6


Loading invisible widgets in background 3)

▪ Option for widgets: “Always initialize on startup”


▪ Influencing the performance of your analytic
application if the application is run
using background loading
▪ Allowing accessing widgets that are used in
the onInitialization script without the need to wait for
these widgets to be initialized in the background.​

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 7


Pause Refresh Script API 1)

▪ Typical use cases


▪ Pause the initial refresh of widgets until they are
modified during application onInitialization event to
optimize the application start up performance
▪ Pause the refresh of chart and table after each click of
user action. User can take a couple of actions and
then refresh the table/chart all at once.
▪ Pause the refresh of invisible widgets until they are
getting visible

▪ Pause refresh of chart or table can be configured


in Builder Panel
▪ Setting pause refresh on or off via script API
▪ Chart.getDatasource().setRefreshPaused
▪ Application.setRefreshPaused

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 8


Pause Refresh Script API 2)

Combine pause refresh API and planning


enabled API to achieve the better performance Activate Table:

▪ Set table to planning disabled for the first loading Pause Refresh: false

▪ Set tables to refresh paused for the first Planning Enabled: true
rendering (in widget setting)
▪ Set tables to pause refresh as false as the widget
is needed
▪ Set table to planning enabled Deactivate Table:
Pause Refresh: true
Planning Enabled: false

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 9


Automatic Pause Refresh

▪ Table and Chart enhance existing "Data Refresh" to


choose among "Always Refresh", "Always Pause",
and "Refresh Active Widgets Only", and can be set to
automatically pause-refresh to improve application
loading and runtime performance.

▪ Pause refresh is automatically on for inactive widgets,


including invisible widgets, widgets in inactive tab of
Tabstrip.

▪ When the widget becomes visible again, the pause


refresh will be automatically switched off.

▪ Be able to set data refresh mode using scripting APIs.

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 10


Enable Planning for Tables only if Planning is used

Loading planning enabled table is expensive.


Therefore we suggest:
▪ Set those tables to planning disabled in property
setting :
▪ All tables which are initially invisible
▪ Tables that are used in onInitialization script

▪ Enable above tables to planning enabled at the


end of the onIntialization script or if they become
visible e.g. by tab switch in the tab strip widget.
Table.getPlanning.setEnabled(true);
▪ Pause-refresh API can be leveraged only if the
planning is disabled for the table

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 11


Using MemberInfo object for setDimensionFilter

▪ A setDimensionFilter call using an id only will


trigger a backend roundtrip to fetch the member
description

▪ Using a MemberInfo object with description


instead of id string will avoid the roundtrip

▪ It should be always used if the description is


available

▪ Also if the filter definition never becomes visible


to the end user, some description placeholder
can be used

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 12


Performance Measurement Popup

▪ Better graphical visualization for users to see the performance logging


information of analytic applications.

▪ Performance logging information includes


▪ Script runtime performance
▪ Some events

▪ Users can quickly identify the long running scripts and get the indication
for optimization (appending ?APP_PERFORMANCE_LOGGING=true
in URL, press ctrl+shift+A)

SAP Labs Preview


© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 13
Demo
Official Resources

Official Resources
▪ Analytics Designer performance best practices are published
▪ As Blog: https://saphanajourney.com/sap-analytics-cloud/learning-article/performance-best-practices-for-sap-
analytics-cloud-analytics-designer/
▪ Or Developer Handbook: https://saphanajourney.com/sap-analytics-cloud/analytics-designer/ → download
developer handbook → Chapter 12

▪ Story performance best practices are valid for analytic applications as well for those widgets that are
shared between these 2 artifacts (table, chart, geo map etc.)
▪ For details please refer to the best practices of story: https://saphanajourney.com/sap-analytics-cloud/learning-
article/best-practices-for-performance/

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 15


Summary
Summary / Most Important to Remember

▪ To reach the best application start up performance and save system resource, please
smartly combine the following options
▪ Background loading for invisible widgets
▪ Access as less invisible widgets as possible in onInitialization event
▪ Always initialize on Startup for the needed widgets in onInitialization event
▪ Pause Refresh the invisible widgets and the widgets that are used in onInitialization event

▪ Switch off the planning capability of planning tables if they are not needed or not needed at
the application initialization
▪ Apply pause refresh as much as possible to
▪ invisible widgets and
▪ widgets used in OnInit event
▪ Planning use case
▪ Enable end user to do some UI actions and then refresh chart/table at once

▪ Use Member Info Object for filtering to provide member description

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 17


Resources

▪ Developer Handbook LINK


▪ Analytics Designer Community Page LINK
▪ Help Documentation LINK
▪ Learning Track LINK

© 2021 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 18


Thank you.

You might also like