容量计划跟踪

Web 请求通过操作系统的许多层,大多数层都可以进行调整。使用日志管理器跟踪 IIS 和内核事件可以帮助您确定服务器的哪些部分能够调整以改善性能,并指出服务器上的 Web 瓶颈。

日志管理器和跟踪报告是随 Windows Server 2003 家族提供的通用工具。日志管理器创建跟踪数据,这些数据随后由 Windows 跟踪报告实用工具处理。跟踪报告实用工具创建一个带格式的详细报告,对于评估 IIS 和操作系统中与 IIS 有关的活动,该报告非常有用。通过提供要跟踪的特定 IIS 事件的列表,在日志中记录了数据在每个 IIS 子系统中的时间长短。日志管理器可用于“应用程序”模式或“专用”模式。

为简单起见,下面阐释了一个特定的跟踪报告。对于该示例以及可能要跟踪的其他子系统,可能会有许多变化形式。

要点 要点 为了运行脚本和可执行文件,您必须是本地计算机上 Administrators 组的成员,或者必须已经被委派了相应的权限。作为安全性的最佳操作,请使用不属于 Administrators 组的帐户登录计算机,然后使用运行方式命令以管理员身份运行脚本或可执行文件。在命令提示符下,键入 runas /user:administrative_accountname "script or executable command"

执行容量计划跟踪

  1. 创建包含下列日志管理器查询提供程序列表的纯文本文件。确保该文件中没有空行。要查看可包含在该文件中的日志管理器查询提供程序的完整列表,请打开命令提示符窗口,然后键入 logman query provider
    {1fbecc45-c060-4e7c-8a0e-0dbd6116181b} 0 5 IIS: SSL Filter
    {3a2a4e84-4c21-4981-ae10-3fda0d9b0f83} 0 5 IIS: WWW Server
    {06b94d9a-b15e-456e-a4ef-37c984a2cb4b} 0 5 IIS: Active Server Pages (ASP)
    {dd5ef90a-6398-47a4-ad34-4dcecdef795f} 0 5 Universal Listener Trace
    {a1c2040e-8840-4c31-ba11-9871031a19ea} 0 5 IIS: WWW ISAPI Extension
    
  2. systemroot\System32 目录中将该文件保存为“iistrace.guid”。
  3. 创建一个包含下列内容的纯文本文件。确保该文件中没有空行。根据您的服务器负荷,您可能希望向下列命令中添加 -bs(块大小)和 -nb(块数)选项。有关日志管理器选项的详细说明,请在 Windows 帮助中搜索“logman”。
    logman start "NT Kernel Logger" -p "Windows Kernel Trace" (process,thread,disk) -ct perf -o krnl.etl -ets
    logman start "IIS Trace" -pf iistrace.guid -ct perf -o iis.etl -ets
    
  4. systemroot\System32 目录中将该文件保存为 startlogiis.bat
  5. 创建一个包含下列内容的纯文本文件。确保该文件中没有空行:
    logman stop "IIS Trace" -ets
    logman stop "NT Kernel Logger" -ets
    
  6. systemroot\System32 目录中将该文件保存为 stoplogiis.bat
  7. 确保要跟踪的站点和进程正在运行。
  8. 打开命令提示符窗口并切换到 systemroot\System32 目录。
  9. 在命令提示符处,键入 startlogiis,然后按 Enter。跟踪随即开始。等一段时间以便收集跟踪数据。记录到磁盘中的数据量大约是每个请求 1 KB。记录活动的时间量取决于请求数以及要记录到的驱动器的可用磁盘空间。通常只需一两分钟的时间来记录。
  10. 在命令提示符处,键入 stoplogiis,然后按 Enter。跟踪随即停止。
  11. 在命令提示符处,键入 tracerpt iis.etl krnl.etl -o -report -summary,然后按 Enter。跟踪报告工具分析日志文件并创建三个带格式的报告:workload.txt、summary.txt 和 dumpfile.csv - 位于 systemroot\System32 目录中。dumpfile.csv 文件是值用逗号分开的文本文件,用于导入到电子表格软件中,以便对跟踪的事件进行详细的分析和疑难排解。有关如何分析 dumpfile.csv 文件的详细讨论,请参考 Windows Server 2003 资源工具包 (Windows Server 2003 Resource Kit)。
  12. 使用自己喜爱的编辑器查看报告文件。

示例工作负荷报告

通过查看 testreport.txt 文件,您可以看到运行时间最长的请求是对 ASP 的请求,它们还占用了最多的 CPU 资源。从“10 most requested static URLs”表中,可以看到 HTTP.sys 内核缓存为许多静态文件请求提供服务。从“10 Most Requested URLs”表中,还可以看到没有缓存 ASP 响应。

+-----------------------------------------------------------------------------------------------------------------------------------+
| Windows Event Trace Session Report v. 9999                                                                                        |
+-----------------------------------------------------------------------------------------------------------------------------------+
| Build     :  9999      Processors:  4     CPU Speed:   700 MHz  Memory:  2048 MB                                                  |
|                                                                                                                                   |
| Trace Name:  IIS Trace                                                                                                            |
| File Name :  c:\windows\System32\iis.etl                                                                                          |
| Start Time:   7 Jun 2002     9:00:12.060       |_____________________________________________________________________|            |
| End Time  :   7 Jun 2002     9:16:53.700                                                                                          |
| Duration  :  1001            sec                                                                                                  |
|                                                                                                                                   |
| Trace Name:  NT Kernel Logger                                                                                                     |
| File Name :  c:\windows\System32\krnl.etl                                                                                         |
| Start Time:   7 Jun 2002     9:00:01.607       |______________________________________________________________________|           |
| End Time  :   7 Jun 2002     9:16:54.935                                                                                          |
| Duration  :  60              sec                                                                                                  |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
| Http Requests Response Time Statistics                                                                                            |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Request Type        |      Rates (/s)    Avg Resp. Time (ms)          UL %       W3 %   W3Fltr %    ISAPI %      ASP %      CGI % |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Cached Requests     |   533.842 ( 74.8%)                   0.064    100.0%       0.0%       0.0%       0.0%       0.0%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Non Cached Requests |   180.316 ( 25.2%)                  33          7.7%       2.0%       0.0%      34.1%      56.1%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| --- ASP             |   178.368 ( 25.0%)                  33          7.5%       2.0%       0.0%      34.2%      56.2%       0.0% |
| --- Static http     |     1.947 (  0.3%)                   7         93.3%       6.5%       0.3%       0.0%       0.0%       0.0% |
| --- CGI             |     0.000 (  0.0%)                   0          0.0%       0.0%       0.0%       0.0%       0.0%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Total               |   714.158 (100.0%)                   8          8.3%       2.0%       0.0%      33.9%      55.7%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
| Http Requests CPU Time Usage Statistics                                                                                           |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Request Type        |      Rates (/s)             % CPU Time          UL %       W3 %   W3Fltr %    ISAPI %      ASP %      CGI % |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Cached Requests     |   533.842 ( 74.8%)                0.1%        100.0%       0.0%       0.0%       0.0%       0.0%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Non Cached Requests |   180.316 ( 25.2%)               70.0%          2.6%       3.0%       0.1%       1.6%      92.7%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| --- ASP             |   178.368 ( 25.0%)               68.1%          2.6%       0.2%       0.1%       1.7%      95.4%       0.0% |
| --- Static http     |     1.947 (  0.3%)                2.0%          2.0%      98.0%       0.0%       0.0%       0.0%       0.0% |
| --- CGI             |     0.000 (  0.0%)                0.0%          0.0%       0.0%       0.0%       0.0%       0.0%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
| Total               |   714.158 (100.0%)               70.2%          2.8%       3.0%       0.1%       1.6%      92.5%       0.0% |
+---------------------+-------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Most Requested URLs                                                                                                           |
+----------------------------------------------------------------------------------+------------------------------------------------+
|  URL                                                                             | SiteID  Rates (/s)  CacheHits  Avg RespTime(ms)|
+----------------------------------------------------------------------------------+------------------------------------------------+
|  http://example/file2K.txt                                                       |      1      85.158     100.0%           0.1    |
|  http://example/file3K.txt                                                       |      1      63.316     100.0%           0.1    |
|  http://example/file512.txt                                                      |      1      50.579     100.0%           0.1    |
|  http://example/file256.txt                                                      |      1      43.368     100.0%           0.1    |
|  http://example/file1K.txt                                                       |      1      42.053     100.0%           0.1    |
|  http://example/file4K.txt                                                       |      1      35.842     100.0%           0.1    |
|  http://example/app.asp                                                          |      1      29.526       0.0%          11.7    |
|  http://example/Session.asp                                                      |      1      28.789       0.0%          12.0    |
|  http://example/file5K.txt                                                       |      1      28.158     100.0%           0.1    |
|  http://example/QueryStr.asp                                                     |      1      27.789       0.0%          11.4    |
+----------------------------------------------------------------------------------+------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Most Requested Static URLs                                                                                                    |
+----------------------------------------------------------------------------------+------------------------------------------------+
|  URL                                                                             | SiteID  Rates (/s)  CacheHits  Avg RespTime(ms)|
+----------------------------------------------------------------------------------+------------------------------------------------+
|  http://example/file2K.txt                                                       |      1      85.158     100.0%           0.1    |
|  http://example/file3K.txt                                                       |      1      63.316     100.0%           0.1    |
|  http://example/file512.txt                                                      |      1      50.579     100.0%           0.1    |
|  http://example/file256.txt                                                      |      1      43.368     100.0%           0.1    |
|  http://example/file1K.txt                                                       |      1      42.053     100.0%           0.1    |
|  http://example/file4K.txt                                                       |      1      35.842     100.0%           0.1    |
|  http://example/file5K.txt                                                       |      1      28.158     100.0%           0.1    |
|  http://example/file6K.txt                                                       |      1      27.368     100.0%           0.1    |
|  http://example/file7K.txt                                                       |      1      21.211     100.0%           0.1    |
|  http://example/file12K.txt                                                      |      1      16.474     100.0%           0.1    |
+----------------------------------------------------------------------------------+------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Slowest URLs                                                                                                                  |
+----------------------------------------------------------------------------------+------------------------------------------------+
|  URL                                                                             | SiteID  Rates (/s)  CacheHits  Avg RespTime(ms)|
+----------------------------------------------------------------------------------+------------------------------------------------+
|  http://example/fibo.asp                                                         |      1       5.947       0.0%         521.3    |
|  http://example/server.asp                                                       |      1      23.842       0.0%          38.4    |
|  http://example/hello.asp                                                        |      1      22.211       0.0%          17.1    |
|  http://example/sessid.asp                                                       |      1      20.947       0.0%          14.3    |
|  http://example/Form.asp                                                         |      1      19.316       0.0%          13.3    |
|  http://example/Session.asp                                                      |      1      28.789       0.0%          12.0    |
|  http://example/app.asp                                                          |      1      29.526       0.0%          11.7    |
|  http://example/QueryStr.asp                                                     |      1      27.789       0.0%          11.4    |
|  http://example/file512K.txt                                                     |      1       1.000       0.0%           9.2    |
|  http://example/file1M.txt                                                       |      1       0.947       0.0%           5.1    |
+----------------------------------------------------------------------------------+------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 URLs with the Most CPU Usage                                                                                                  |
+----------------------------------------------------------------------------------+------------------------------------------------+
|  URL                                                                             | SiteID        Rates (/s)         CPU Time      |
+----------------------------------------------------------------------------------+------------------------------------------------+
|  http://example/fibo.asp                                                         |      1             5.947           59.03%      |
|  http://example/server.asp                                                       |      1            23.842            3.71%      |
|  http://example/file1M.txt                                                       |      1             0.947            1.41%      |
|  http://example/app.asp                                                          |      1            29.526            1.09%      |
|  http://example/Session.asp                                                      |      1            28.789            1.00%      |
|  http://example/QueryStr.asp                                                     |      1            27.789            1.00%      |
|  http://example/Form.asp                                                         |      1            19.316            0.78%      |
|  http://example/hello.asp                                                        |      1            22.211            0.78%      |
|  http://example/sessid.asp                                                       |      1            20.947            0.70%      |
|  http://example/file512K.txt                                                     |      1             1.000            0.55%      |
+----------------------------------------------------------------------------------+------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 URLs with the Most Bytes Sent                                                                                                 |
+----------------------------------------------------------------------------------+------------------------------------------------+
|  URL                                                                             | SiteID  Rates (/s)  CacheHits  Bytes Sent (/s) |
+----------------------------------------------------------------------------------+------------------------------------------------+
|  http://example/file1M.txt                                                       |      1       0.947       0.0%      993656      |
|  http://example/file128K.txt                                                     |      1       7.000     100.0%      919079      |
|  http://example/file200K.txt                                                     |      1       3.789     100.0%      776936      |
|  http://example/file256K.txt                                                     |      1       2.316     100.0%      607591      |
|  http://example/file512K.txt                                                     |      1       1.000       0.0%      524571      |
|  http://example/file32K.txt                                                      |      1      15.632     100.0%      515717      |
|  http://example/file64K.txt                                                      |      1       7.579     100.0%      498391      |
|  http://example/file33K.txt                                                      |      1       7.684     100.0%      261386      |
|  http://example/file16K.txt                                                      |      1      13.895     100.0%      230763      |
|  http://example/file3K.txt                                                       |      1      63.316     100.0%           208625    |
+----------------------------------------------------------------------------------+------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Clients with the Most Requests                                                                                                |
+-----------------------------------------------------------------------------------------------------------------------------------+
|      IP Address            Rates (/s)       CacheHits        Avg Resp Time (ms)                                                   |
+-----------------------------------------------------------------------------------------------------------------------------------+
|  192.168.1.42                                                         357.789           74.3%                    9                |
|  192.168.1.43                                                         356.368           75.2%                    7                |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Clients with the Slowest Responses                                                                                      |
+-----------------------------------------------------------------------------------------------------------------------------------+
|      IP Address            Rates (/s)       CacheHits        Avg Resp Time (ms)                                                   |
+-----------------------------------------------------------------------------------------------------------------------------------+
|  192.168.1.42                                                         357.789           74.3%                    9                |
|  192.168.1.43                                                         356.368           75.2%                    7                |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Sites with the Most Requests                                                                                                  |
+-----------------------------------------------------------------------------------------------------------------------------------+
|   Site ID   Rates (/s)                  Avg Resp Time (ms)          Cached Requests    Static File           CGI          ASP     |
+-----------------------------------------------------------------------------------------------------------------------------------+
|         1      714.158                                   8                    74.8%           0.3%          0.0%        25.0%     |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Sites with the Slowest Responses                                                                                        |
+-----------------------------------------------------------------------------------------------------------------------------------+
|   Site ID   Rates (/s)                  Avg Resp Time (ms)          Cached Requests    Static File           CGI          ASP     |
+-----------------------------------------------------------------------------------------------------------------------------------+
|         1      714.158                                   8                    74.8%           0.3%          0.0%        25.0%     |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Sites with the Most CPU Time Usage                                                                                            |
+-----------------------------------------------------------------------------------------------------------------------------------+
|   Site ID   Rates (/s)     CacheHits        Avg Resp Time (ms)        Avg CPU Time (ms)                % CPU Time                 |
+-----------------------------------------------------------------------------------------------------------------------------------+
|         1      714.158         74.8%                    8                        3                        70.182%                 |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
|  10 Sites with the Most Bytes Sent                                                                                                |
+-----------------------------------------------------------------------------------------------------------------------------------+
|   Site ID   Rates (/s)                     Bytes Sent (/s)          Cached Requests    Static File           CGI          ASP     |
+-----------------------------------------------------------------------------------------------------------------------------------+
|         1      714.158                             7565233                    74.8%           0.3%          0.0%        25.0%     |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
| Image Statistics                                                                                                                  |
+-----------------------------------------------------------------------------------------------------------------------------------+
| Image Name          PID       Threads    Threads        Process             Transaction                CPU%                       |
|                               Launched    Used     KCPU(ms)  UCPU(ms)    KCPU(ms)   UCPU(ms)                                      |
+-----------------------------------------------------------------------------------------------------------------------------------+
| logman.exe       0x00000594          4        1         45         15          0          0            0.06                       |
| wmiprvse.exe     0x00000888          5        0          0          0          0          0            0.00                       |
| w3wp.exe         0x00000AC4         47       26       2070      72795          0          0           69.68                       |
| cmd.exe          0x00000CAC          1        1         30         30          0          0            0.06                       |
| Idle             0x00000000          5        4      13185          0          0          0           12.27                       |
| System           0x00000004        211       11       2430          0          0          0            2.26                       |
| .                                                                                                                                 |
| .                                                                                                                                 |
+-----------------------------------------------------------------------------------------------------------------------------------+
|                                    612       63      19680      73215          0          0   Total:  86.46%                      |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
| Disk Totals                                                                                                                       |
+-----------------------------------------------------------------------------------------------------------------------------------+
| Disk Name        Reads         Avg KB           Writes         Avg KB                                                             |
+-----------------------------------------------------------------------------------------------------------------------------------+
|      0              0               0              21               3                                                             |
+-----------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------+
| Disk   0                                                                                                                          |
+-----------------------------------------------------------------------------------------------------------------------------------+
| Authority                PID          Image Name                             Read     Avg      Write    Avg                       |
|                                                                              Count     Kb      Count     Kb                       |
+-----------------------------------------------------------------------------------------------------------------------------------+
| system                   0x00000004   System                                     0      0         21      3                       |
+-----------------------------------------------------------------------------------------------------------------------------------+
相关主题

© 1997-2003 Microsoft Corporation。保留所有权利