Optimize canvas apps
Two primary approaches to development are imperative and declarative. Imperative development focuses on how to achieve a goal, while declarative development focuses on specifying the desired outcome. Imperative development offers more flexibility because it allows control over each step in the process, but it typically requires more code and complexity. Declarative development is simpler and more straightforward to use but may not offer the same level of control.
Canvas apps take your declarative "what" and optimize the "how." In some cases, you might not be able to precisely express the desired result declaratively, so Power Apps allows the use of imperative techniques. A common mistake is to use imperative development when declarative options would be simpler and perform better.
Canvas apps can be visually appealing, but performance has a greater impact on user adoption.
For more information on imperative and declarative development, see Use imperative development techniques for canvas apps in Power Apps.
The following sections discuss techniques for optimizing canvas app performance.
Offload logic to server-side components
As app formulas grow in size and complexity, consider offloading logic to other Microsoft Power Platform or server-side services. Logic can be handled by Microsoft Power Automate cloud flows, business rules, plug-ins, or other server-side features in Dataverse.
Note
A common technique is to offload logic to a Power Automate cloud flow that uses the Power Apps trigger. The flow can be called from a Power Apps expression, which passes data to the flow and returns a result.
You can also create custom connectors to Microsoft Azure Functions or other logic services. If imperative development is being used in an app, evaluate whether the logic would be more appropriate elsewhere.
Improve app performance
Common performance challenges include:
- Data access – Apps retrieve large data sets into collections and perform client-side operations like Join, Sort, Add Column, and Group By.
- Formulas in OnStart – Apps trigger unnecessary data calls at startup, returning large records.
- Repeated data retrieval – Use the Set function to cache data from lookup tables locally.
Encourage makers to use the ClearCollect function to cache data in OnStart, and use the Concurrent function to reduce the time to load multiple datasets.
The following images illustrate loading datasets sequentially versus concurrently:
With so many configuration options, performance should be considered continuously. Improvements and analysis should be ongoing. Refer to slow performance sources, common performance issues, and performance tips.
A solution architect should implement a canvas app performance-tuning strategy.
A tuning strategy should:
- Avoid unnecessary work
- Defer work that is unlikely to be needed
- Parallelize work wherever possible
- Monitor app usage to uncover performance issues
Use a visual progress indicator to inform users during long-running operations.
Use Test Studio, Azure Monitor, and Application Insights
Canvas apps should be tested thoroughly to ensure reliability. Microsoft provides Test Studio for regression testing, which can be included in automated build processes.
Test Studio includes:
- Suites – Groups of test cases
- Tests – Sets of test steps to validate app behavior
- Test steps – Actions written in the Power Apps expression language
- Test assertions – Expected results for validation
Microsoft Azure Monitor allows makers to stream user session events for diagnosing and troubleshooting issues. Makers can view Monitor events in Power Apps Studio while building apps and monitor runtime behavior in published apps. For model-driven apps, Monitor tracks navigation, commands, and form-level issues.
Canvas apps can be connected to Application Insights, a feature of Azure Monitor. Application Insights provides analytics tools to help diagnose issues and understand user behavior.
Data available from Application Insights includes:
- Number of active users
- Locations where the app is used
- Frequently used screens
- User flow from one screen to another
As a solution architect, you should decide whether to include Application Insights in your app solutions.
For more information, see Application Insights.