Troubleshoot Performance-Related Issues
- 3 minutes to read
In modern applications, multiple aspects can affect performance, such as:
- Client computers or web browsers
- Web server types, their geographic locations, software, and hardware
- Database server engines along with their physical location and maintenance
- Network communication and latency between system components
- Custom application code and third-party libraries
- Use-case scenarios (database record count, number of concurrent users, etc.)
To determine the cause of performance issues, you need to collect app-specific data, such as execution time of .NET or JavaScript methods in problematic scenarios, network latency, or hardware specifications.
The best way to determine the underlying cause of performance issues is to profile application components with specialized performance profilers or loggers. Once you profile your application components and analyze the profiling logs, you will know exactly what contributes to performance delays and will be able to take optimization actions.
If your Blazor Web App has performance issues, we strongly recommend that you troubleshoot it as described in sections below before you submit a ticket to our Support Center. Otherwise, our support team would not be able to help you resolve your issues.
Diagnose the Issue
Change Application Environment
The local environment could be causing the issue. Try changing:
- The browser
- The operating system
- The machine where you run your application
Investigate Performance Profile
Use profiling and diagnostic tools to diagnose memory and CPU usage and other application-level issues. These tools gather performance data during application execution. You can use built-in diagnostic tools in Visual Studio or other third-party solutions of your choice to debug .NET code. Refer to the following Microsoft tutorial for more information: Measure app performance in Visual Studio.
DevTools profiler helps analyze runtime performance of scripts. Refer to the following article for more information: Analyze runtime performance.
Exclude Influence of Third-Party Libraries
Third-party libraries (scripts and stylesheets) can influence page performance significantly. For instance, they can send a lot of additional requests to the server, increase the page size, etc. Temporarily disable external libraries to determine their impact on application performance.
Use Another Hosting Model
Blazor components can run on the server-side or client-side (in the browser). Refer to Microsoft documentation for more information on how hosting models affect applications both at compile and runtime:
- Hybrid apps and native Blazor applications under .NET 8: ASP.NET Core Blazor hosting models
- Native Blazor applications in .NET 8+: ASP.NET Core Blazor render modes
Bind to Another Data Source
Try a test data source instead of a real source. Bind components to an in-memory data source instead of a database, or use a smaller data set.
Remove Custom CSS and Complicated Templates
Browsers iterate through all DOM elements to find specified CSS rules for each element and compute actual styles. A page with many DOM elements can slow down rendering, especially when CSS rules change component/element visibility. Refer to the following articles for more information about style calculation:
- Analyze CSS selector performance during Recalculate Style events
- Reduce the scope and complexity of style calculations
If the Issue Persists
Create a new ticket in the DevExpress Support Center, attach a sample project and performance profiling screenshots for future research.
Helpful Resources
Ensure that your application integrates the correct patterns and features. Refer to the Microsoft documentation for the latest recommendations: ASP.NET Core Blazor performance best practices.