PL 400: Optimize app performance including pre-loading data and query delegation(Manage and troubleshoot apps)

Certainly, canvas apps provide a platform where anyone can design/develop apps. They have to drag and drop controls on a blank canvas app visual tool and design a user interface. Building apps with PowerApps makes everyone from business analysts to professional developers work together more efficiently.

When solving business problem with intuitive visual tools, performance is the key factor that determines the success or failure of apps. App performance indicates how the app is working and how the app is responding to the end user.

Poor performance has many consequences, but the main reason of bad performance is poor design of fundamental architecture or design features. Such poor performance impacts on customer relationships, business failures, lost income and more. In Canvas Apps, Microsoft provides best standards and practices which helps in developing efficient and robust apps. During the design of canvas apps, the app makers must also take care of the best use of each component.

The below factors should be considered during canvas app design for optimized performance:
  • Load Data
  • Query Delegation
  • Local Caching
  • Concurrent Calls
  • Delayed Load
  • Formula Optimization
  • File Optimization 
  • Connector Limits
  • Control Optimization and Dependency 

Load Data:

Generally, data is the soul of the app, but additional data load or communication with data sources always poses challenges to the performance of the app. For better performance, canvas app makers like to preload multiple tables and entities during the state of their app. This feature dramatically enhances performance. 

  • Setting global variables e.g. For the colors and other repeatable  that will be used throughout the app
  • Get and store records in a collection e.g. for offline capabilities

Query Delegation:

Query delegation is a name power apps ability to delegate the processing of queries to the underlying data source instead of processing them locally in memory. A delegable power apps can improve query performance drastically and work with large datasets.

Few points need to know about this feature:

  • This is not default feature, It need to configure in Advance Setting Option.
  • Default limit for non-delegable queries is 500.
  • Only below data sources are supported the delegation
    • Microsoft Dataverse
    • SharePoint
    • SQL Server
  • Imported Excel files (static), collection and tables store in variables , therefore those don't need to delegate.
  • Every Data source is different and its associated delegable functions vary based on the data sources.
  • Filter, Search and Lookup functions are delegable functions.

Local Caching:

Cache is reserved storage space that collects temporary data to help apps load faster. This makes it easy to retrieve  data quickly which in turn helps the device run faster.

There are two type of caching :

Local Caching : It is cache data in the memory space.
Distributed Caching: It is an independent process and is generally deployed on different machine.

The use of local caching in the canvas app reduces repetitive calls to data sources across the network. ClearCollect function helps to cache data locally if it does not change during user session. Use the Set function to cache data from view tables locally to avoid returning data repeatedly from sources.

Concurrent Calls:

The idea of ​​concurrent calls is based around a user having access to more than one call at a time. The concurrent function evaluates multiple formulas at the same time. Generally, several formulas are evaluated by chaining them simultaneously at the same time ; operator that evaluates each one sequentially. When the app operates concurrently, users wait less for the same result. 

Sequentially Call:


Concurrent Call:


Delayed Load:

Delayed load is one of the features that preview mode still has, but it does have a significant impact on app performance. This setting is enabled by default and if we disable it then an app will load all screen and data controls on startup. This prevents apps from pre-loading screens that a user does not open. Microsoft recommends that if the app has more than 10 screens, no rules, and multiple controls that span multiple screens and are tied directly to the data source. If we build this type of app and do not enable this feature, the performance of the app may be affected as the controls in all the screens must be populated even on the screens that are not open.


Formula Optimization:

A formula is an expression used in an app to perform an action or a mathematical operation at a specific value. This helps create a more interactive and dynamic user experience in the Canvas app, but excessive use of formulas significantly impacts app performance, so Microsoft recommends optimizing the use of formulas. In this way, we can use the below exercises to improve the performance.

  • Avoid repeating the same formula in multiple places
  • Avoid using Form.updates in rules and formula
  • Use first filter rather than lookup function
  • Use concurrent function to run formula parallel, if they don't depend on each other.
  • Use the variable as result instead of runtime formulas.
File Optimization:

There are many file types used in the Canvas app such as images, videos and audio files. The small file size ensures about the performance of the app. We can delete all unused media from the app to clean or reduce the size of the app.

Connector Limits :

The Canvas app can use multiple connectors at a time but Microsoft recommends that having more than 30 data source connectors has a huge impact on the app's performance. Each additional connector increases the amount of time the app needs to start up. When an app runs, each connector requires CPU resources, memory, and network bandwidth when the app requests data from that source.

Control Optimization and Dependency:

The general recommendation is that no app should use more than 500 controls, as it hurts the performance of the app. It's a better idea to reuse controls and avoid additional controls for the same functionality. To optimize the use of reusable controls, we can use galleries and components that take advantage of reusability. Most importantly, makers should avoid referencing controls across multiple screens, as the canvas app loads the entire screen at a time that is used as a reference which hinders performance improvement. Delay output is also an important feature that needs to be addressed during control use, as it drives each key press of the keyboard. 

Debug Published enabled:

Certainly, the Debug Publish Enabled feature plays an important role in debug and troubleshooting with Monitor as it provides additional information about the runtime of the app, but enabling this feature makes , has a decisive impact on performance of app for all users. Disable this setting as soon as possible to reduce the impact as we no longer need to see the source expression while debugging the published app.

Conclusion

Experiencing poor app performance means delay work, high resource consumption and business loss. As is known, modern apps give an edge to modern business, but poor performance destroys the benefits of modern technologies as well. All of the above features have their advantages and disadvantages, so the fundamental architect design is the most important factor in app performance. App makers should take care of all the factors during the design of canvas app.

Comments

Popular posts from this blog

Powering Up Your Analytics: Exploring Power Query in Power BI

Power App Component Overview : Canvas App vs Model-Driven App

Exam PL-400: Microsoft Power Platform Developer