Optimising Servers
In a Nutshell - CIW Course Section 3, Part B3, Chapter 2
Analysing Server Performance
The analysing of server performance can be a very complex task requiring the use of many tools and utilities to gain an in-depth understanding of the activity. Simpler measures may be employed to form a basic picture of the server and network dynamics. Often it is important to consider a number of servers as a working group rather than trying to analyse individual servers.
Server and service logs would usually be the starting point for gathering basic statistics. Then, utilities such as tracert, traceroute in Linux, can determine the network path between two hosts and the speed response times of the connection of different hosts in the path. netstat can provide more information about network traffic. Protocol Analysers or packet sniffers can look much more deeply into network activity.
Queues and Bottlenecks
Queues are a perfectly normal occurrence in any network environment. A server can only process one request at a time and processing this request takes a finite length of time. If another request arrives while the first is being processed then it must wait, or queue. If many requests are arriving and the server cannot process them in a timely fashion the queue will lengthen and become a bottleneck.
To eliminate, or minimise these bottlenecks the source of the delay must be identified. It may be that the server requires more memory, an extra CPU, faster disks, or an extra NIC to cope with the traffic. Windows 2000 Performance Monitor can help identify the offending component(s).
Additional servers in a clustered environment can balance the load so that each server is performing optimally.
Using Windows 2000 Performance Monitor
One of the most common objects to monitor the performance of, is the PhysicalDisk object. Before this can be monitored fully in Performance Monitor, the disk counters must be enabled in Windows. This is achieved by running the command diskperf -y at the command prompt. The system will need to be rebooted to enable the counters.
By right-clicking in the right-pane of the main window and selecting "Add Counters" the above dialog is displayed. "PhysicalDisk", "% Idle Time" has been selected which will give a basic indication of how busy the disk is. On my server, the idle time was fairly high, I am the only user on it!
Once finished with monitoring disk activity, you should remember to disable the disk counters with diskperf -n and reboot. The counters do put overhead on the server.
Top Program
Top is a Linux program that can determine the amount of memory each process is using. This is output in the form of a report. While the Top program is running, a number of commands can be issued interactively:
- s: Specifies the interval for the Top program to update it's data
- S: Toggles the Cumulative Mode on/off
- h: Access the Help screen
- P: Sorts data by CPU usage
- u: Search processes
- K: Stop or kill a process
VMSTAT
VMSTAT is another Linux utility, that counts memory usage and other resources of all running processes. The VMSTAT commands are split into a number of categories: procs, memory, swap, lo, system and CPU. Each category has a number of field values to identify the measurement to be taken. The procs category has three field values:
| Vmstat Process Categories | ||
|---|---|---|
| Category | Field Values | Process |
| procs | r: | Lists number of requests in a queue waiting for a runtime |
| b: | Lists number of sleeping processes | |
| w: | Lists number of processes moved to virtual | |
The memory category has three field values to measure different areas of memory, in kilobytes:
| Vmstat Process Categories | ||
|---|---|---|
| Category | Field Values | Process |
| memory | swpd: | Measures virtual memory used at any one time |
| free: | Measures unused available memory | |
| buff: | Measures memory used in buffers | |
The CPU category has three field values and the remaining categories each have two field values. But, there is insufficient space here to provide details.
Improving Server Performance
A point I made in the last chapter is that, improving server performance is different from optimising server performance. Mostly, improving server performance is common sense. Adding memory, upgrading to a faster CPU, adding extra CPUs are the most popular upgrades. Installing a faster NIC can make a significant improvement, as can adding multiple NICS.
The course suggests changing IDE disks for SCSI as the latter are far quicker. This used to be true, but with the latest IDE drives rivalling SCSI speeds, it is difficult to justify the extra cost. Using RAID (Redundant Array of Independent Disks) can improve performance, but depending upon the RAID level used, it may provide redundancy at the expense of performance.
Note: The highlighted acronym, above, is, I thought, an inconsistency. I believe RAID stands for: Redundant Array of Inexpensive Disks. A question in TMA05, for this section, asks the question and offers 4 multiple-choice options, none of which are the acronym highlighted above. It does offer my acronym, so after consulting Google, it appears the two terms can be used interchangeably.
Adjusting Server Performance in IIS
Open the selected web site properties and click the "Performance" tab. The dialog box below, should be displayed.
The main setting is the "Performance tuning" slider control which sets the number of expected visitors for the site. Bandwidth throttling and process throttling are limits place on the web site so are not, to my mind, performance improving. However, if this server is hosting multiple web sites, this could be a good way of balancing the performance of individual web sites.
Adjusting Server Performance in Apache
To adjust Apache performance settings you must be logged in as root. The settings for Apache are contained in the text file /etc/httpd/conf/http.conf.
The two main values we are interested in are: MaxKeepAliveRequests and MaxClients, increasing these values should increase the performance. Save the file and restart the server.

