|
PC Performance and the SAS System Casey Thompson PC Systems SAS Technical Support Abstract There is a quote that I remember from a few years ago that still rings true – "PC’s are to the 90’s what cars were to the 50’s". People like to see what modifications they can make to their machines to make them run as fast as possible. Optimizing performance of the SAS System on a Windows operating system is one of the more common types of questions the PC Systems team in Technical Support receives every year. The goal of this paper is to explore a broad overview of hardware tuning, operating system modifications, SAS System performance enhancements and methods of efficient programming for achieving optimal performance on a Windows operating system. Testing before tuning The first step in optimizing any system is to determine if any one of the PC subsystems is causing a performance bottleneck. Each PC component depends heavily on the other major subsystems to keep the data flowing through the system. If either the system’s processor, it’s memory or the disk subsystems are insufficient to meet the demands placed upon them, they will force the other subsystems to wait ,causing serious performance degradation - the condition we refer to as a performance bottleneck. Just like the mechanic hooking your car up to a diagnostic computer to determine which parts of the engine aren’t functioning at their peak performance, we’ll run your personal computer through diagnostic routines to test the performance level of your individual system components. Testing these components enables us to remove the bottlenecks by either adding or upgrading the hardware components slowing down the system and/or allows us to set the SAS and Windows system options more appropriately once we know what resources we have available on each PC. Windows Performance Monitor
Testing these components is easily accomplished using Window’s Performance Monitor. This application Performance Monitor can be found under the Programs -> Administrative Tools menu in Windows NT or Settings -> Control Panel -> Administrative Tools ->Performance in Windows 2000. To setup Performance Monitor for your system testing, select the Performance Objects and Counters desired for the graphical display. To start adding these values, click on the plus sign tool in the Performance Monitor toolbar. This will bring up the Add Counters dialog. First select the Performance Object you want, this will populate the Select Counters listbox with that object’s available counters. Click on a counter then the Add button, a colored line corresponding to that counter will be added to the interactive graph. When testing your system, it is important to run programs that represent typical stresses on that system. If your SAS programs generally consist of statistical procedures these may stress different system subsystems than programs that manipulate large or multiple files. For example, statistical SAS procedures like Proc Mixed or Proc Nlin can be very CPU intensive where Proc MDDB may stress the memory subsystem and Proc Sort can tax the I/O subsystem. Testing applications that do not represent a typical workload may not give you a true picture of the changes you could make that would make the most impact. These are a few basic objects and counters you might want to use in checking for performance bottlenecks and the values that indicate problems: Testing the Processor for a bottleneck: Processor Performance Object
Testing for Memory bottlenecks: Memory Performance Object 1. Pages/Sec – counters that stay over 5 2. Available Bytes – values below 4 megabytes indicate excessive paging Server Performance Object 1. Pool Paged Failures – these indicate a virtual memory bottleneck 2. Pool Non Paged Failures – these indicate that memory is too small I/O bottlenecks: PhysicalDisk Performance Object
These are the most commonly used values to determine system performance and are usually sufficient to obtain the application performance information we want, however, there are other objects and counters available for examining other aspects of your system’s performance as well. Hardware Some background of PC hardware is necessary to differentiate between systems and to help determine which components can improve the overall processing speed of your computer. As discussed previously, the 3 major subsystems are the CPU, memory and the disk subsystem. CPUs CPU’s have followed
Memory Presently, there are several kinds of memory on the market. Memory is available in these types, SDRAM – Synchronous Dynamic Random Access Memory, DDR – Double Data Rate and RDRAM – RAMBUS Dynamic Random Access Memory. SDRAM comes in 2 speeds, PC100 and PC133 that refers to the bus speed of the memory module: 100MHz or 133MHz. This translates to 100 million to 133 million clock cycles per second. SDRAM memory handles 1 operation per clock cycle. The SDRAM bus is 64 bits wide. DDR RAM is SDRAM but with an important difference - it transmits data on both the rising an falling edges of the clock cycle which means it can handle 2 operations for every cycle. This gives the DDR memory a effective speed of twice that of standard SDRAM memory. RDRAM is memory that uses a smaller bus than SDRAM - 16 bits versus 64 bits. But the RDRAM memory is capable of running at higher speeds. The fastest RDRAM memory buses available run at 530 megahertz. RDRAM uses the same rising/falling edge technology as DDR RAM does.
All memory access speeds are measured in nanoseconds. Nanoseconds are billionths of a second. Current memory speeds are measured in the 10 nanosecond range. With access times for hard drives is measured in milliseconds, thousandths of a second we can see that memory of any type is several million times faster than any of the hard drives available. One of the primary goals of performance tuning is to maximize memory usage versus accessing the I/O subsystem. The I/O subsystem Hard drives are composed of a number of round disks called platters. Each platter is divided into tracks much like the grooves on a phonograph record. These tracks are further subdivided into sectors each holding a fixed number of bytes of data. Different size hard drives have different numbers of sectors per track. The more sectors that are squeezed in to each track the higher the density of the media and the higher the storage capability. The higher density drives enable more data to be transferred given the same rotational speed of the drive because more data passes per revolution under the drive heads that read the data. The two main factors that contribute to hard drive performance are the access time and the data transfer rate. The transfer rate is a combination of the speed of the hard drive, measured in revolutions per minute and the density of the data. Current hard drives have rotational speed from 5400 revolutions per minute all the way up to 15,000 revolutions per minute. Access time is the time between a request from the operating system to read some data to that data being read. Hard drives may come equipped with a built in memory cache. These caches are composed of memory chips to hold frequently used data. For example, a Western Digital WD1000JBRTL100 gigabyte 7200 RPM hard drive uses an 8 megabyte cache to store data and due to the higher speed of memory chips, the stored data may be accessed quicker than reading the data from the drive. The conclusion from this understanding of the hard drive structure is that you want to get the drive that has the fastest rotational speed, the lowest access time and the highest transfer rate with a good size memory cache. (That you can afford!) Since a single hard drive cannot keep pace with the faster CPUs and Memory on the typical PC system, a more effective solution to increase the I/O component speed can be to use two or more drives, similar to the use of multiple processors. There are several ways to configure these drives that will increase performance. In this section we’ll focus on the hardware configurations. The SAS System and Windows operating system option changes that use more than one physical drive for performance gains will be discussed later. Multiple drives can be configured into RAID arrays. RAID stands for Redundant Array of Independent Disks, enabling the operating system to treat multiple disks as if they were one large volume. There are many different modes of RAID, the most common being 0, 1 and 5, each mode serving a different purpose. RAID arrays are used for increasing I/O performance, for fault tolerance and for data redundancy. RAID 0 "stripes" data across multiple disks. Striping is the writing of data to more than one drive at a time. This increases performance by utilizing more than 1 set of drive heads to access the data. The downside of RAID 0 is that if 1 disk crashes, data on both drives is lost. RAID 0 and RAID 1 is available natively with Windows 2000 and XP, no additional software of hardware is required other than the additional hard drives. RAID 1 uses two or more disks and builds mirror images of the data on each, providing no performance benefit but greatly increased fault tolerance and redundancy. If one drive is lost, the data from the other mirrored drive is still available. RAID 5 combines a version of striping with creating parity strips across all drives. This results in greatly increased fault tolerance and data redundancy but is not designed for maximum performance. RAID 5 requires a hardware controller. Operating System Any Window’s operating system generally runs well using the default setup options but there are a few option changes that can be made and maintenance performed to maximize the performance of your PC. Disk fragmentation is one of the most common reasons for substandard I/O throughput. During normal computer use, files can become fragmented. That is, written to widely disparate portions of the hard drive that can result in a slower access time for subsequent retrieval. Keeping the drive defragmented by regularly running a disk defragmentation application will insure that files can be accessed in the most efficient way. The Window’s pagefile (also called the swapfile) increases the operating system’s available memory space beyond the amount of physical memory installed by using unused disk space as virtual memory. When the amount of physical memory is insufficient, the operating system will write the oldest and least used pages of memory to the pagefile, freeing the physical memory for the current request. This pagefile is dynamic by default - that is, the pagefile can change in size and the drive location used. By specifying a static pagefile on a defragmented drive, the pagefile can be written permanently as a contiguous file. To make the pagefile static, make the beginning and ending pagefile size the same and direct the pagefile to one location. This will keep the pagefile from becoming fragmented over time. A less fragmented pagefile can result in quicker access. Improved pagefile performance can also be achieved by redirecting the pagefile to a separate physical drive (not just a separate partition). Virtual memory can be changed by going through the System Properties window – Start -> Settings -> Control Panel ->System. For Windows NT, go to the Performance tab then the Change button to view or modify virtual memory settings. With Windows 2000, the path is the Advanced tab, the Performance button then the Change button.
Microsoft recommends a pagefile size that is approximately one and one half times the amount of the physical memory installed. A pagefile that is too big may negatively impact performance by requiring too many system resources to administer. Existing file system errors can also cause performance loss. In addition to using a disk defragmentation tool regularly, using the Windows Error Checking application will help your system to operate efficiently. The Error checking utility can be accessed in all Windows operating systems from Windows 95 to Windows XP by opening My Computer then right-clicking on the drive you want to check. Select the Properties tab then the Tools tab. The SAS System is usually not the only software running on any computer. Windows operating systems run background processes as part of the normal startup – a typical Windows 2000 workstation has over a dozen services that start with the boot of the PC. These processes consume system resources. Windows Task Manager will show all the current processes and services and their current system usage:
Other common applications can also drain your system of some of its capacity – instant messaging applications, screensavers, internet browsers (often multiple instances!), email clients, antiviral applications, system monitoring applications, media players are among the many application types in use. All of these require system attention, using CPU cycles, taking up memory address space and generally slowing your system down. As the Task Manager picture shows, the system CPU is already at a third of capacity and two thirds of the available memory is in use. Any SAS job run in this type of environment will get only a fraction of the resources it could have. The SAS System The SAS System is designed to run as optimally as possible under Windows operating systems when initially installed. However, there a few option settings that can be adjusted to better suit individual circumstances. Sortsize - The default Sortsize is 2 megabytes. This value can be changed. Setting this parameter from between one quarter to one half of the size of the amount of physical memory installed can provide better sort performance. Test your system to determine the optimal value. Work – the work option determines where SAS creates its utility files. If a second physical disk is available, redirecting the work library to that disk can bring significant performance benefits of up to forty percent. A RAID 0 array is ideal for the work option location. The multiple drives of the RAID 0 speed the I/O subsystem for SAS System temporary file accesses. Bufno – the bufno option maximizes memory usage. Higher bufno values mean more pages transferred per I/O operation. This can be useful from a performance standpoint if abundant RAM is available. These options can be modified in your SAS configuration file – sasv8.cfg. This file is usually located in the same folder as the sas.exe executable. SAS Compression – if the system processor is strong enough, this option can provide faster access time. Most recent CPU’s, one gigahertz and faster, should be more than up to the task but again, check your system using Performance Monitor to be sure. If your SAS programs generate a lot of log messages, setting autoscroll to zero or minimizing your log window will help the job complete faster. Running the SAS program in batch frees the SAS System from updating any of the Display Manager windows. There are several ways to run SAS in batch: In Windows Explorer, right click on a SAS program and select Batch Submit. From the Start -> Run dialog or a Command Prompt, type the SAS batch command: "c:\program files\sas institute\sas\v8\sas.exe" –sysin c:\myprogs\one.sas Programming Efficiency Now that we have optimized your PC to run as quickly as possible, lets look at some programming methods that will make your code as efficient as possible. The goal of these methods is much the same as the goals we pursued with the hardware and software changes. We want to reduce the I/O, keep data in memory as much as possible and reduce unnecessary data access.
For further diagnostic testing of your SAS programs, you can use the ARM (Application Response Measurement) macros to test the individual sections of each program. Version 9 Looking ahead to the imminent release of Version 9 of the SAS System, I have included some performance enhancements you can look forward to:
References If you’d like to read more in depth on any of the topics covered in this paper, the following sources cover them in greater detail:
Help! My NT Server is too slow! http://ftp.sas.com/techsup/download/technote/ts636.pdf
Windows NT Server
Configuration and Tuning for Optimal Server Performance http://www2.sas.com/proceedings/sugi26/p277-26.pdf
Taking Advantage
of the SAS System on the Windows Platform http://www2.sas.com/proceedings/sugi25/25/sy/25p280.pdf
The DATA Step in
Version 9: Whats New?
Windows 2000
Performance Tuning White Paper · Tuning Your
NT Server for the SAS System by Jamie Walker http://www.sas.com/partners/directory/intel/tnntser.pdf · A Practical
Approach to Solving Performance Problems with the SAS System Tom Brown http://support.sas.com/rnd/papers/sugi27/SolvingPerformance.pdf · Using large
datasets with NT and NTFS SAS Companion for
the MS Windows Environment V8 p82 |