当前位置:网站首页>NETCORE performance troubleshooting

NETCORE performance troubleshooting

2022-06-25 10:22:00 @@Mr.Fu

One 、 Performance check

  • The concept of performance

    Performance comes from the system .

    The system is divided into two categories :web System 【BS】 And the client 【 desktop 】 System 【CS】.

  • Performance indicators are based on

    Two bases :

    1. Number Number of client execution interfaces , That is to say 1 How many request interfaces can be executed per second , The more you deal with , The higher the performance .

    2. Time The time from the client request to the server and respond to the request is called Performance time ; The shorter the time, the higher the performance .

      Pictured :

     Insert picture description here

    Time and quantity are contradictory : The shorter the time, the greater the number of executions 【 throughput 】, The longer the time, the less the number of executions .

    The starting point of performance is the execution time of an interface .

  • Get the execution time of the system interface

    Tools :

    1. Apche JMeter 【 Commonly used 】
    2. ApcheBench(ab) Command line tools 【 Commonly used 】
    3. Gatling
    4. K6
    5. Locust
    6. West Wind WebSurge
    7. Netling
    8. Vegeta
    9. NBomber
  • Performance diagnostics

    • Tools

      1. VS Built in performance detector
    • CPU The reasons for the rise in usage

      1. while for loop

        Solution : Use Hash Table search stores data

      2. File operations

        Solution : asynchronous IO DoNetty

      3. Network connection and network data transmission

        Solution : Use caching to store data perhaps Use asynchronous IO Multiplexing mechanism

        CPU The defect of increasing utilization :

        The ability to handle interface concurrency decreases

        The throughput of the system decreases

  • Performance troubleshooting

    • Conditions

      • NET CORE 3.1 SDK or More advanced version
      • dotnet-counters Check managed memory usage
      • dotnet-dump Collect and analyze dump files
    • step

      1. Create a memory overflow item

      2. install dotnet-counters Get ready

        dotnet tool install --global dotnet-counters
        
      3. Find the process number

        dotnet-counters ps
        
      4. Monitor progress

        dotnet-counters monitor --refresh-interval 1 -p [ Process number ]
        
      5. Finally, view the display statistics

        find GC Heap Size Count the growth of this program , In order to find out the code of memory overflow .

      6. dotnet-dump install

        dotnet tool install --global dotnet-dump 
        
      7. Then execute the project interface

        Run the project

      8. Generate dump file

        dotnet-dump collect -p [ Process number ]
        
      9. Then analyze the dump file

        dotnet-dump  analyze [ Dump file name ]
        
      10. To analyze

      dumpheap -stat
      
      1. Analyze the specific objects of the type

        dumpheap -mt [ Type number ]
        
      2. Find the application root

        gcroot -all [ Object number ]
        
原网站

版权声明
本文为[@@Mr.Fu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250915501928.html