Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

microsoft press internet information services iis 70 resource kit phần 9 potx
MIỄN PHÍ
Số trang
82
Kích thước
690.9 KB
Định dạng
PDF
Lượt xem
1272

microsoft press internet information services iis 70 resource kit phần 9 potx

Nội dung xem thử

Mô tả chi tiết

620 Part IV: Troubleshooting and Performance

Impact of Constraints

When a server is low on RAM, it uses the paging file, causing the worker process to have to

retrieve data from disk, slowing down performance. This can be an expensive operation,

because the application has introduced another potential bottleneck, Disk I/O (Input/Output).

An application that is forced to use a portion of the information swapped to the paging file

has added latency and causes the server to use more resources.

Generally, with 32-bit operating systems, the recommended approach is to set the paging file

size to be 1.5 times the amount of RAM. In a 64-bit environment, you can set the operating

system to automatically handle the paging file size.

Countermeasures

One countermeasure against memory pressure is to verify that your Web server paging file is

configured properly and optimized on a separate set of disks. Spreading a paging file across

separate physical disks enables you to improve paging file performance by using drives that

do not contain your site’s content or log files. Although these steps are basic, they can go a

long way toward helping your application’s performance. They can also save your company

money by getting the most out of your servers.

Understanding how many resources a typical transaction uses is important. This number can

be valuable when you calculate what your production environment and monitoring thresh￾olds will be. If your database holds a lot of detail data, you can calculate how the data might

grow over a period of months or years and how this might impact your application. It might

perform well at first, but you might find that as the amount detail data grows, your application

will be slower, and server performance will suffer.

Process(w3wp)\Virtual Bytes The current size, in bytes, of the virtual address

space the process is using. Use of virtual address

space does not necessarily imply corresponding

use of either disk or main memory pages. Virtual

space is finite, and the process can limit its ability

to load libraries.

Process(w3wp)\Working Set The current size, in bytes, of the Working Set of

this process. The Working Set is the set of

memory pages touched recently by the threads

in the process. If free memory in the computer is

above a threshold, pages are left in the Working

Set of a process even if they are not in use. When

free memory falls below a threshold, pages are

trimmed from Working Sets. If they are needed,

they will then be soft-faulted back into the

Working Set before leaving main memory.

Table 17-4 Memory Counters to Measure

Counter Name Description

Chapter 17: Performance and Tuning 621

Hard Disks

As faster and faster disks evolve, chances of the disk being the issue become less likely.

Redundant Array of Inexpensive Disk (RAID) and striping technologies are not really IIS￾related performance tricks, but they can help increase your server’s overall performance. The

real effect on hard disks depends on how much RAM your machine has.

What Causes Hard Disk Pressure?

Typically, pressure is a matter of the amount of disk reads and writes. A Web server that has a

high ratio of reads to writes tends to perform better. The Reliability and Performance Monitor

is a great tool for analyzing the total number of reads and writes a Web server generates. If

your application requires a lot of writes, you should have faster disks and a RAID implemen￾tation to support them. Disk bottlenecks can be improved by using Kernel-mode caching,

which greatly eliminates the number of direct reads from the disk.

Hard Disk Counters to Monitor

See Table 17-5 for a list of common hard disk counters that help identify which processes and

how much of the server resources are being used when your IIS 7.0 server is experiencing hard

disk-related issues.

Table 17-5 Disk Counters to Measure

Counter Name Description

PhysicalDisk(_Total)\% Disk Time The percentage of elapsed time that the selected

disk drive was busy servicing read or write requests.

PhysicalDisk(_Total)\% Disk Read Time The percentage of elapsed time that the selected

disk drive was busy servicing read requests.

PhysicalDisk(_Total)\% Disk Write Time The percentage of elapsed time that the selected

disk drive was busy servicing write requests.

PhysicalDisk(_Total)\Current Disk Queue

Length

The number of requests outstanding on the disk at

the time the performance data is collected. It also

includes requests in service at the time of the

collection. This is an instantaneous snapshot, not an

average over the time interval. Multispindle disk

devices can have multiple requests that are active at

one time, but other concurrent requests are awaiting

service. This counter might reflect a transitory high

or low queue length, but if there is a sustained

load on the disk drive, it is likely that this will be

consistently high. Requests experience delays

proportional to the length of this queue minus

the number of spindles on the disks. For good

performance, this difference should average less

than two.

622 Part IV: Troubleshooting and Performance

Impact of Constraints

Your application’s performance and throughput will be affected if your IIS 7.0 server does not

have enough RAM. When a server has to start writing and retrieving information from disk,

there will be latency to your application’s performance. Disk paging can be an expensive task,

and using disk performance counters can help you measure how your server is performing.

Countermeasures

You can implement a few countermeasures to help prevent disk latency. Here are some things

to keep in mind:

■ Choose the correct RAID for your server(s).

■ When implementing RAID, select a hardware controller over a software RAID solution.

It’s definitely worth the investment.

■ You can spread your paging file across multiple disks.

■ More spindles help with performance. Several smaller disks are faster than one large

drive.

■ Speed is very important. Faster disks help with performance, and in the long run they

are worth the few extra dollars they cost.

■ Definitely monitor performance by using the counters mentioned in this section.

■ Keep your disks from becoming fragmented.

■ For a Web server, have the logging and content on separate disk from the operating

system. Logging can be an expensive operation, so try to move logging to a separate set

of disks. Alternatively, offload it to a remote server.

Note To help you out with logging, we’d like to point out an option called httpLogging,

which enables you to control how much data is logged to your IIS log files. One attribute of

httpLogging, selectiveLogging, enables you to control which status codes are logged to your IIS

Logs. By default, the selectiveLogging option is set to LogAll, which means log all status codes.

You can set the value to LogSuccessful, which logs all HTTP status codes from 100 to 399. The

LogError option logs HTTP status codes from 400 to 999. The following example shows you

PhysicalDisk\Disk Reads/sec The rate of read operations on the disk.

PhysicalDisk\Disk Writes/sec The rate of write operations on the disk.

PhysicalDisk\Avg. Disk Bytes/Read The average number of bytes transferred from the

disk during read operations.

PhysicalDisk\Avg. Disk Bytes/Write The average number of bytes transferred to the disk

during write operations.

Table 17-5 Disk Counters to Measure

Counter Name Description

Chapter 17: Performance and Tuning 623

how to adjust the selectLogging setting by using Appcmd. You can also set httpLogging to

dontLog, which will prevent any logs from being generated. Logging is discussed more in

Chapter 15, “Logging.”

//Code sample to set the selectiveLogging attribute using Appcmd.

//LogAll is the default, LogSuccessful and LogError are the other options.

Appcmd set config -section:httpLogging -selectiveLogging:LogSuccessful

//Here is the part of the schema that controls the system.webServer/ httpLogging/selective￾Logging attribute

<attribute name="selectiveLogging" type="enum" defaultValue="LogAll">

<enum name="LogAll" value="0" />

<enum name="LogSuccessful" value="1" />

<enum name="LogError" value="2" />

</attribute>

Turn off unnecessary disk intensive services such as Index Server or other search type

functions if the service is not in use. These types of services can continually index content and

take up precious disk cycles.

Tuning your hard disk subsystem is one issue you’ll probably not have to deal with when

working to optimize your system. Providing your server with enough RAM can go a long way

towards ensuring that your hard disk is not the cause when a problem arises.

Network

One of the best performance enhancements in Microsoft Windows Server 2008 is a complete

redesign of the Transmission Control Protocol/Internet Protocol (TCP/IP) stack, also

known as the Next Generation TCP/IP stack. The TCP/IP stack has been redesigned to

enable high-speed multi-gigabit capabilities without consuming all of the CPU power and

resources on the server. It integrates security products into the Windows platform and makes

it more manageable. In addition, the TCP/IP stack has been redesigned to make it more

easily serviced, to add capabilities, and to let third-party independent software vendors (ISVs)

add capabilities to it (specifically in the firewall and antivirus categories).

What Causes Network Pressure?

In a perfect world, bandwidth restrictions would not be an issue. Switched networks as well

as 1 GB and greater network speeds have helped, but network utilization still can be a

bottleneck. How you deal with it can make your applications successful or not. The increasing

availability of high-speed networks and broadband connections does not guarantee a low

latency experience.

624 Part IV: Troubleshooting and Performance

High demand for content such as video streaming or audio files can lead to pressure on the

network. The Internet is one big wide area network, and it takes only one slow connection to

become saturated and cause packet loss. When packet loss occurs, higher latency and slower

response times for applications can occur. Low latency and slow application response are less

likely in a local area network. However, the network is only as strong as the weakest link.

Network Counters to Monitor

See Table 17-6 for a list of common network counters used to identify network-related issues

on your IIS 7.0 server.

Impact of Constraints

Dealing with slow router points or switches that are saturated can constrain how you provide

services and keep the network functional. Using QoS (Quality of Service) and scheduling

network-intensive operations during off-hours can help the impact on your network.

Having tools in place to monitor your network can help you spot trends and understand

if your network is operating efficiently. The Next Generation TCP/IP stack supports the

IETF draft RFC 4898, “TCP Extended Statistics MIB,” which defines extended performance

statistics for TCP. By analyzing ESTATS on a connection, you can determine whether a

connection’s performance is based on the sending application, the receiving application, or

the network. ESTATS is disabled by default and can be enabled per connection. With

ESTATS, non-Microsoft independent software vendor (ISVs) can create powerful diagnostics

and network throughput analysis applications. Tcpanalyzer.exe, which is available in the

Windows Vista SDK, is a diagnostic tool based on ESTATS.

The Explicit Congestion Notification (ECN) feature also enhances performance. When a TCP

segment is lost, TCP assumes that the segment was lost due to congestion at a router, and it

performs congestion control, dramatically lowering the TCP sender’s transmission rate. With

ECN support on both TCP peers and in the routing infrastructure, a router experiencing

congestion mark packets as it forwards them. TCP peers receiving marked packets lower their

Table 17-6 Network Counters to Measure

Counter Name Description

Network Interface(NICNAME)\Bytes Total/sec The rate at which bytes are sent and received over

each network adapter, including framing charac￾ters. Network Interface\Bytes Total/sec is a sum of

Network Interface\Bytes Received/sec and Network

Interface\Bytes Sent/sec.

Network Interface(NICNAME)\Current Band￾width

An estimate of the current bandwidth of the net￾work interface in bits per second (BPS). For interfac￾es that do not vary in bandwidth or for those where

no accurate estimation can be made, this value is

the nominal bandwidth.

Chapter 17: Performance and Tuning 625

transmission rate to ease congestion and prevent segment losses. Detecting congestion

before packet losses are incurred increases the overall throughput between TCP peers. ECN is

not enabled by default. To enable ECN, run this command: netsh interface tcp set global

ecncapability=enabled.

Countermeasures

How do you know what your network utilization is? Right-click in the Start Bar, select Task

Manager, and navigate to the Networking tab. Select the network interface you would like

to view and check its network utilization statistics. If your primary network card is close to

100 percent, the card is likely a bottleneck in the performance of your application. Generally,

you should start to investigate if network utilization is around 50 percent. Figure 17-3 shows

how Task Manager presents network utilization statistics.

Figure 17-3 Network utilization in Windows Task Manager.

The Next Generation TCP/IP stack is a complete redesign of TCP/IP functionality for

both IPv4 and IPv6 that meets the connectivity and performance needs of today’s varied

networking environments and technologies. The following features are new or enhanced:

■ Receive Window Auto-Tuning

■ Compound TCP

■ Enhancements for high-loss environments

■ Neighbor Unreachability Detection for IPv4

■ Dead Gateway Detection

626 Part IV: Troubleshooting and Performance

■ Path Maximum Transmission Unit (PMTU) Black Hole Router Detection

■ Routing Compartments

■ Network Diagnostics Framework Support

■ Windows Filtering Platform

■ Explicit Congestion Notification

With its many new features and enhancements, Windows Server 2008 should help keep

network pressure at a minimum. For more information, see the article posted on TechNet

called “New Networking Features in Windows Server 2008 and Windows Vista” at

http://technet.microsoft.com/en-us/library/bb726965.aspx.

Application-Level Counters

Microsoft provides several key application-level counters that can be useful in troubleshooting

your application. Table 17-7 presents a subset of counters that can help troubleshoot ASP.NET

and Web-related issues.

Table 17-7 Application Counters

Counter Name Description

.NET CLR Exceptions(w3wp)\# of Exceps Thrown

/ sec

The number of exceptions thrown per second.

These include both .NET exceptions and unman￾aged exceptions that get converted into .NET ex￾ceptions (e.g., a null pointer reference exception

in unmanaged code would get rethrown in

managed code as a .NET System.NullReference￾Exception). This counter includes both handled

and unhandled exceptions. Exceptions should

only occur in rare situations and not in the

normal control flow of the program; this counter

was designed as an indicator of potential

performance problems due to large (>100s) rate

of exceptions thrown. This counter is not an

average over time; it displays the difference

between the values observed in the last two

samples divided by the duration of the sample

interval.

.NET CLR Jit(w3wp)\% Time in Jit The percentage of elapsed time spent in JIT

compilation since the last JIT compilation phase.

This counter is updated at the end of every JIT

compilation phase. A JIT compilation phase is the

phase when a method and its dependencies are

being compiled.

.NET CLR Jit(w3wp)\IL Bytes Jitted / sec The total IL bytes jitted since the start of the

application. This counter is exactly equivalent to

the “Total # of IL Bytes Jitted” counter.

Chapter 17: Performance and Tuning 627

.NET CLR Loading(w3wp)\% Time Loading

.NET CLR Loading(w3wp)\Current appdomains The current number of AppDomains loaded in

this application. AppDomains (application

domains) provide a secure and versatile unit of

processing that the CLR can use to provide

isolation between applications running in the

same process.

.NET CLR Loading(w3wp)\Current Assemblies The current number of Assemblies loaded across

all AppDomains in this application. If the Assem￾bly is loaded as domain-neutral from multiple

AppDomains, then this counter is incremented

once only. Assemblies can be loaded as domain￾neutral when their code can be shared by all Ap￾pDomains, or they can be loaded as domain-spe￾cific when their code is private to the

AppDomain.

.NET CLR LocksAndThreads(w3wp)\Queue

Length / sec

The total number of times threads in the CLR

have attempted to acquire a managed lock un￾successfully. Managed locks can be acquired in

many ways—by the “lock” statement in C#, or by

calling System.Monitor.Enter, or by using Meth￾odImplOptions.Synchronized custom attribute.

.NET CLR LocksAndThreads(w3wp)\Total # of

Contentions

The total number of times threads in the CLR

have attempted to acquire a managed lock un￾successfully. Managed locks can be acquired in

many ways—by the “lock” statement in C#, or by

calling System.Monitor.Enter, or by using Meth￾odImplOptions.Synchronized custom attribute.

.NET CLR Memory(w3wp)\% Time in GC The percentage of elapsed time that was spent in

performing a garbage collection (GC) since the

last GC cycle. This counter is usually an indicator

of the work done by the Garbage Collector on

behalf of the application to collect and compact

memory. This counter is updated only at the end

of every GC, and the counter value reflects the

last observed value; it is not an average.

.NET CLR Memory(w3wp)\# Total Committed

Bytes

The amount of virtual memory (in bytes) current￾ly committed by the Garbage Collector. (Com￾mitted memory is the physical memory for which

space has been reserved on the disk paging file.)

.NET CLR Memory(w3wp)\# Bytes in all Heaps The sum of four other counters—Gen 0 Heap

Size, Gen 1 Heap Size, Gen 2 Heap Size, and the

Large Object Heap Size. This counter indicates

the current memory allocated in bytes on the GC

Heaps.

Table 17-7 Application Counters

Counter Name Description

Tải ngay đi em, còn do dự, trời tối mất!