Requirements: When developing a web website application, developers must care about the performance of the website (this article refers to the access speed), if the website access speed is very slow, users may give up and choose other websites, and 57% of users will leave after 3 seconds!
MiniProfiler is a library and UI for analyzing your application. By letting you see where your time is spent, what queries are running, and any other custom time you want to add, MiniProfiler can help you debug issues and optimize performance.
The information monitored by MiniProfiler can be stored in memory, MongoDb, MySql, SqlServer, Redis, PostgreSql, and many other storage media. Support for ORMs such as EF, EFCore, NHibernate, etc., which can monitor the executed SQL and execution time, making it easy to optimize SQL.
MiniProfiler Official Website:The hyperlink login is visible. MiniProfiler GitHub open source address:The hyperlink login is visible.
This article uses aASP.NET Core 6project to test, nuget installs the package as follows:
Register the following services in Program.cs (using the default configuration) with the following code:
Using the MiniProfiler middleware, the code is as follows:
at_ViewImports.cshtmlAdd a quote as follows:
Add the MiniProfiler to your view master page, the default file is:_Layout.cshtml, the code is as follows:
This tag generates the following HTML source code.
When you try to run the project, you can see the time-consuming statistics in the upper left corner, as shown below:
Click the share link to see the details, as shown below:
(End) |