为方便问题发生后,问题原因的分析排查,我们可以在服务器中事先开启logman功能搜集服务器的性能数据,方便故障发生后,问题原因的分析排查
Windows服务器部署Permon性能搜集器:
1.使用管理员权限打开CMD窗口
2.配置Perfmon信息:
Logman create counter Perf-2Second -f bincirc -max 500 -c "LogicalDisk(*)*" "Memory*" "Network Interface(*)*" "Paging File(*)*" "PhysicalDisk(*)*" "Server*" "System*" "Process(*)*" "Processor(*)*" "Cache*" -si 00:00:02 -o C:PerfMonLogsPerf-2Second.blg
备注:
a.日志的保存路径“C:PerfMonLogsPerf-2Second.blg ”,可以根据实际情况自行定义,目录及文件“PerfMonLogsPerf-2Second.blg”会自动生成及创建
b.-max参数后的值为日志文件的大小,单位为MB,如果日志文件已经达到该值,则会循环往复的覆盖
c.经测试Windows Server 2008/2012都可以使用该命令开启perfmon
3.开启Perfmon:
Logman start Perf-2Second
4.等待问题复现
5.停止并删除Perfmon
Logman stop Perf-2Second
Logman delete Perf-2Second
6.实测输出如下:
7.可以使用pma脚本文件分析permon日志,分析后的日志输出格式见下:
Areas to Investigate ==================== PhysicalDisk(0 C:)Split IO/Sec [Min: 0, Max: 478.994, Avg: 0.11] - Split IO operations make up 5.43% of Disk Transfers. - RAID may be too small/NTFS block too small. - Disk may have moderate to heavy fragmentation. Process(_Total)Handle Count [Min: 19,061, Max: 22,570, Avg: 20,283] - This may be a normal amount on Terminal Servers in Application Mode. - Investigate individual applications using > 1,500 handles. Performance Monitor Log Summary =============================== Log Filename : PERF-2SECOND_000001.BLG Server Name : HLMWIN12R2N Start Date & Time : 11/21/2017 17:17:16 (Uptime was: 2d 9h 3m 31s) End Date & Time : 11/22/2017 03:15:13 (Uptime was: 2d 19h 1m 28s) Log Duration : 0d 9h 57m 57s Total Samples : 17939 Sample Interval : 0d 0h 0m 2s Memory Minimum Maximum Average ========================================================================= Available Bytes : 2,513MB | 2,940MB | 2,900MB Pool Paged Bytes : 183MB | 241MB | 183MB Pool NonPaged Bytes : 200MB | 200MB | 200MB Free System PTEs : 16,506,914 | 16,507,676 | 16,507,522 Handle Count : 19,061 | 22,570 | 20,283 Thread Count : 554 | 653 | 573 Private Bytes : 590MB | 954MB | 601MB Virtual Bytes : 71,310,739 | 94,380,546 | 73,863,112 Working Set : 856MB | 1,275MB | 899MB Cache Bytes : 80MB | 89MB | 82MB Committed Bytes : 1,496MB | 1,884MB | 1,507MB Commit Limit : 4,800MB | 4,800MB | 4,800MB % Committed Bytes Used : 31% | 39% | 31% Pages/sec : 0 | 8,336.8 | 4.586 Processor Minimum Maximum Average ========================================================================= Processor Queue Length : 0 | 7 | 0 % Processor Time : 0% | 100% | 0.54% Processor: 0 : 0% | 100% | 0.56% Processor: 1 : 0% | 100% | 0.56% % User Time : 0% | 84.89% | 0.29% Processor: 0 : 0% | 98.58% | 0.29% Processor: 1 : 0% | 89.76% | 0.28% % Privileged Time : 0% | 40.05% | 0.15% Processor: 0 : 0% | 36.91% | 0.17% Processor: 1 : 0% | 43.19% | 0.13% % DPC Time : 0% | 1.57% | 0.01% Processor: 0 : 0% | 3.14% | 0.02% Processor: 1 : 0% | 0.78% | 0% % Interrupt Time : 0% | 0.78% | 0% Processor: 0 : 0% | 1.56% | 0% Processor: 1 : 0% | 0.79% | 0% Physical Disk Minimum Maximum Average ========================================================================= % Idle Time : 49.99% | 100.2% | 99.72% Disk: 0 C: : 0.01% | 100.2% | 99.48% Disk: 1 D: : 0% | 100.2% | 99.96% Avg. Disk sec/Transfer : 0 | 0.145 | 0.001 Disk: 0 C: : 0 | 0.108 | 0.001 Disk: 1 D: : 0 | 0.152 | 0 Disk Bytes/sec : 0KB | 60,887KB | 70KB Disk: 0 C: : 0KB | 60,883KB | 63KB Disk: 1 D: : 0KB | 20,545KB | 8KB Avg. Disk Queue Length : 0 | 2.587 | 0.003 Disk: 0 C: : 0 | 2.586 | 0.002 Disk: 1 D: : 0 | 2.432 | 0.001 Split IO/Sec : 0 | 478.994 | 0.11 Disk: 0 C: : 0 | 478.994 | 0.11 Disk: 1 D: : 0 | 0 | 0 Disk Transfers/Sec : 0 | 616.916 | 2.092 Disk: 0 C: : 0 | 602.477 | 2.024 Disk: 1 D: : 0 | 395.427 | 0.069 Network Interface Minimum Maximum Average ========================================================================= Bytes Total/sec isatap.ipfyev4shubendc5qqpcvzgsb: 0KB | 0KB | 0KB Microsoft Hyper-V Network Adapte: 0KB | 10,308KB | 15KB Current Bandwidth isatap.ipfyev4shubendc5qqpcvzgsb: 0Mbit | 0Mbit | 0Mbit Microsoft Hyper-V Network Adapte: 10,000Mbit | 10,000Mbit | 10,000Mbit Output Queue Length isatap.ipfyev4shubendc5qqpcvzgsb: 0 | 0 | 0 Microsoft Hyper-V Network Adapte: 0 | 0 | 0 Packets/sec isatap.ipfyev4shubendc5qqpcvzgsb: 0 | 0 | 0 Microsoft Hyper-V Network Adapte: 0 | 5,369 | 11 Packets Received Discarded isatap.ipfyev4shubendc5qqpcvzgsb: 0 | 0 | 0 Microsoft Hyper-V Network Adapte: 0 | 0 | 0 Packets Received Errors isatap.ipfyev4shubendc5qqpcvzgsb: 0 | 0 | 0 Microsoft Hyper-V Network Adapte: 0 | 0 | 0 TOP 10: Handle Count Minimum Maximum Average ========================================================================= 1. lsass : 3,968 | 5,642 | 4,778 2. svchost#3 : 1,340 | 1,591 | 1,362 3. explorer : 1,352 | 1,549 | 1,361 4. DiagnosticsPlugin : 641 | 1,047 | 845 5. svchost#9 : 708 | 890 | 726 6. WindowsAzureGuestAgent : 587 | 861 | 711 7. MonAgentCore : 638 | 752 | 711 8. System : 718 | 751 | 720 9. MsMpEng : 499 | 585 | 508 10. svchost#5 : 551 | 583 | 552 TOP 10: Thread Count Minimum Maximum Average ========================================================================= 1. System : 105 | 106 | 105 2. svchost#3 : 34 | 56 | 35 3. explorer : 35 | 51 | 36 4. svchost#9 : 33 | 44 | 35 5. MonAgentCore : 35 | 40 | 39 6. MsMpEng : 15 | 25 | 16 7. svchost#8 : 21 | 24 | 21 8. WindowsAzureGuestAgent : 16 | 20 | 17 9. svchost#6 : 16 | 19 | 17 10. svchost#4 : 16 | 18 | 16 TOP 10: Private Bytes Minimum Maximum Average ========================================================================= 1. MsMpEng : 117MB | 392MB | 121MB 2. svchost#3 : 19MB | 128MB | 21MB 3. MpSigStub : 0MB | 74MB | 12MB 4. svchost#9 : 62MB | 68MB | 63MB 5. explorer : 49MB | 63MB | 50MB 6. WaAppAgent : 39MB | 61MB | 39MB 7. WindowsAzureTelemetryService : 49MB | 49MB | 49MB 8. WindowsAzureGuestAgent : 43MB | 43MB | 43MB 9. CollectGuestLogs : 0MB | 35MB | 31MB 10. DiagnosticsPlugin : 32MB | 34MB | 33MB TOP 10: Virtual Bytes Minimum Maximum Average ========================================================================= 1. svchost#5 : 2,098,301M | 2,098,302M | 2,098,301M 2. MsMpEng : 2,097,580M | 2,097,854M | 2,097,582M 3. svchost#8 : 2,097,834M | 2,097,835M | 2,097,834M 4. svchost#3 : 2,097,303M | 2,097,707M | 2,097,322M 5. explorer : 2,097,622M | 2,097,660M | 2,097,633M 6. taskhost : 0MB | 2,097,625M | 2,097,227M 7. svchost#9 : 2,097,351M | 2,097,382M | 2,097,352M 8. dwm#1 : 2,097,296M | 2,097,302M | 2,097,300M 9. rundll32#3 : 0MB | 2,097,294M | 2,097,294M 10. LogonUI : 2,097,291M | 2,097,291M | 2,097,291M TOP 10: Working Set Minimum Maximum Average ========================================================================= 1. MsMpEng : 57MB | 360MB | 87MB 2. svchost#3 : 35MB | 149MB | 37MB 3. explorer : 108MB | 125MB | 109MB 4. svchost#9 : 60MB | 77MB | 60MB 5. MpSigStub : 0MB | 74MB | 15MB 6. WaAppAgent : 44MB | 64MB | 44MB 7. WindowsAzureTelemetryService : 57MB | 57MB | 57MB 8. dwm#1 : 55MB | 57MB | 55MB 9. WindowsAzureGuestAgent : 55MB | 55MB | 55MB 10. DiagnosticsPlugin : 43MB | 46MB | 44MB TOP 10: % Processor Time Minimum Maximum Average ========================================================================= 1. MonAgentCore : 0% | 14.1% | 0.18% 2. MsMpEng : 0% | 99.21% | 0.1% 3. svchost#3 : 0% | 89.06% | 0.08% 4. lsass : 0% | 3.14% | 0.06% 5. WindowsAzureGuestAgent : 0% | 2.36% | 0.03% 6. svchost#9 : 0% | 12.59% | 0.03% 7. svchost#8 : 0% | 63.13% | 0.03% 8. System : 0% | 16.41% | 0.02% 9. svchost#2 : 0% | 1.56% | 0.02% 10. explorer : 0% | 33.04% | 0.01% TOP 10: % Privileged Time Minimum Maximum Average ========================================================================= 1. MonAgentCore : 0% | 5.45% | 0.08% 2. svchost#3 : 0% | 33.59% | 0.03% 3. System : 0% | 16.41% | 0.02% 4. svchost#8 : 0% | 10.91% | 0.02% 5. MsMpEng : 0% | 35.79% | 0.02% 6. WindowsAzureGuestAgent : 0% | 1.57% | 0.01% 7. svchost#9 : 0% | 1.57% | 0.01% 8. svchost#2 : 0% | 1.56% | 0.01% 9. lsass : 0% | 1.57% | 0.01% 10. WmiPrvSE : 0% | 0.79% | 0% TOP 10: IO Data Bytes Minimum Maximum Average ========================================================================= 1. svchost#8 : 0KB | 203KB | 27KB 2. MsMpEng : 0KB | 50,707KB | 20KB 3. rundll32#2 : 0KB | 32KB | 14KB 4. MonAgentCore : 0KB | 411KB | 6KB 5. WaAppAgent : 0KB | 9,945KB | 5KB 6. System : 0KB | 2,505KB | 1KB 7. svchost#3 : 0KB | 3,798KB | 1KB 8. svchost#2 : 0KB | 295KB | 1KB 9. WmiPrvSE : 0KB | 0KB | 0KB 10. WmiPrvSE#1 : 0KB | 7KB | 0KB Report generated by : Performance Monitor Analyzer v1.7 Written By : Jeff Fanjoy, Microsoft Corp. (jfanjoy@microsoft.com) Generated on : 11/22/2017 3:29:33 AM Log processing time : 237 second(s). Relog processing time : 33 second(s). Total Counters : 633 Total Processes : 71 [ADDITIONAL USAGE NOTES] To prevent prompting for configuration (default to '*') set the following registry value: HKCUSoftwareMicrosoftPMAVbsNoPrompt = 1 [REG_DWORD] To change the default number for TOP 'n' processes set the following registry value: HKCUSoftwareMicrosoftPMAVbsNumSummaryInstances = <desired number> [REG_DWORD] (default = 10) To remove the 'Open With Performance Monitor Analyzer' context menu delete the following registry key(s): BLG context menu : HKCRDiagnostic.Perfmon.DocumentshellPMA