High-performance ASP. NET Site build series Article Directories
Use of CLR counters
We use the built-in performance monitoring tool to track and monitor the garbage collector. Next, we will first introduce several common CLR performance monitoring counters. We generally look at the counters under the. net clr Memory category:
Percent Time in GC |
It indicates the percentage of the total time taken to run the garbage collection mechanism from the last time it was run. It must not exceed 10%. |
Gen 0 heap size |
This value does not indicate the size of the Gen 0 object in the managed heap, but refers to the size of the Gen 0 object that can be allocated. |
Gen 1 heap size |
Indicates the size of the managed heap space occupied by the current Gen 1 Object |
Gen 2 heap size |
Indicates the size of the managed heap space occupied by the current Gen 2 object |
Large Object Heap size |
Current LOH size |
# Byte in all Heaps |
YesGen 0 heap size, Gen 1 heap size, Gen 2 heap size, Large Object Heap sizeThe sum of all types, that is, the space occupied by the entire managed heap |
# Gen 0 Collections |
The number of times that the Garbage Collector recycles Gen 0 objects after the system is enabled |
# Gen 1 Collections |
Number of times the Garbage Collector recycles the Gen 1 object since the system is enabled |
# Gen 2 Collections |
Number of times the Garbage Collector recycles the Gen 2 object since the system is enabled |
After introducing some of the counters above, you can run the "perfmon" command to open the performance monitoring tool.
The following describes CLR ProfilerCLR dialysis machine)
CLR Profiler
CLR Profiler is a tool developed by Microsoft. It can be used to detect details about the memory occupied by CLR.
You can download this tool at the following link:
Http://www.microsoft.com/downloads/details.aspx? Familyid = a362781c-3870-43be-8926-862b40aa0cd0 & displaylang = en
The following link details the usage of this tool:
Http://msdn.microsoft.com/zh-cn/magazine/ee309515.aspx#MtViewDropDownText
Here, we will briefly introduce how to use it. For detailed operations, please refer to the above link. The procedure is as follows:
1. Run CLR Proflie
2. Make sure"Profiling active, Allocations, CILS. As follows:
3. Select"File-> Profile ASP. NET". This operation stops IIS running, inserts some commands, and then restarts IIS. Therefore, this tool is used with caution in the production environment.
4. Then, we can run our website F5 in VS (ensure that the site is created in IIS mode when creating the website, instead of selecting"File System")
5. Click"Kill ASP. NET ".This operation will remove some monitoring commands previously added to IIS. After you click the button, some interfaces are displayed. The page displays the size of Gen0, Gen1 Gen2, and LOH, as shown below:
6. You can also click"Histogram"Button. This interface shows the proportions of objects of different sizes and types. The following shows that there are many string objects in the system. In other words, the string objects in the system occupy most of the system's memory space.
Edit recommendations]