Windows Features That Optimize Performance

Controlling SAS Responsiveness

Overview of Controlling SAS Responsiveness

You can control the relative responsiveness of your SAS session by altering the application performance level. Using Windows performance options, you can specify which type of programs, interactive or background, receive more processor time. Use these guidelines to determine the application performance level:
  • If you are running SAS interactively and you want your session to have the best response time, set the performance options for programs or applications.
  • If you are running SAS in batch mode and you want your batch jobs to execute more quickly, set the performance options for background services.
To analyze the performance of your SAS applications, you can specify SAS performance counters within the Windows performance monitor. For more information, see Performance Tools.

Optimizing Application Performance under Windows Vista

Under Windows Vista and Server 2008 R1, follow these steps to optimize application performance:
  1. Open the Control Panel.
  2. Click System and Maintenance.
  3. Select the System .
  4. Click Advanced system settings task.
  5. Select the Advanced tab.
  6. In the Performance box, click Settings and then select the Advanced tab.
  7. To optimize performance of an interactive SAS session, select Programs.
  8. To optimize performance of a batch SAS session, select Background services.
  9. Click OK.

Optimizing Application Performance under Windows 7 and Servber 2008 R2

Under Windows 7 and Server 2008 R2, follow these steps to optimize application performance:
  1. Open the Control Panel.
  2. Click System and Security.
  3. Select the System.
  4. Click Advanced system settings task.
  5. Select the Advanced tab.
  6. In the Performance box, click Settings and then select the Advanced tab.
  7. To optimize performance of an interactive SAS session, select Programs.
  8. To optimize performance of a batch SAS session, select Background services.
  9. Click OK.

Optimizing Application Performance under Windows XP

Under Windows XP, follow these steps to optimize application performance:
  1. Open the Control Panel.
  2. Click System.
  3. Select the Advanced tab.
  4. In the Performance box, click Settings and then select the Advanced tab.
  5. To optimize performance of an interactive SAS session, select Programs.
  6. To optimize performance of a batch SAS session, select Background services.
  7. Click OK.

Optimizing Application Performance under Windows Server 2003

Under Windows Server 2003, follow these steps to optimize application performance:
  1. Open the Control Panel.
  2. Click System.
  3. Select the Advanced tab.
  4. In the Performance box, click Settings.
  5. To optimize performance of an interactive SAS session, select Programs in the Processor Scheduling box.
  6. To optimize performance of a batch SAS session, select Background services in the Processor Scheduling box.
  7. Click OK.

I/O Enhancements for Multiple Processors

If your PC has multiple processors, SAS uses symmetric multiprocessing (SMP) using I/O enhancements. More read-ahead processing is done for procedures that have large amounts of sequential data access on data that is stored on a Windows server. This processing occurs more on systems that have extra processing power to serve Windows and its disk cache.
The following is generally true in multiprocessing SMP environments:
  • Machines that are used as servers for multiple applications perform best if they are SMP-based.
  • SAS/CONNECT remote computing environments perform best if they are SMP-based.
  • The supporting hardware in SMP boxes (RAID, RAM) generally help any application to perform better.

Memory-Based Libraries

Memory-Based Libraries Overview

Using the MEMLIB and MEMCACHE options, you can create memory-based SAS libraries. Depending on your operating environment, extended memory or conventional memory is used to support these memory-based libraries.
Thirty-two bit processing in Windows operating environments uses 2 gigabytes (GB) of physical memory for the operating environment, leaving 2 GB of physical memory available for use by applications. When a PC or server has more than 4 GB of memory, extended memory is defined as the memory that is above 4 GB, all of which is available for use by applications. Extended memory can be used to support memory-based libraries.
Some Windows operating environments do not support extended memory. In operating environments where extended memory is not supported or installed, SAS uses conventional memory to support the MEMLIB and MEMCACHE options. Conventional memory is defined as the memory that is below 4 GB in 32-bit environments and all of the memory in 64-bit environments.
Using memory-based libraries reduces I/O to and from disk, therefore improving SAS performance. Memory-based libraries can be used in several ways:
  • as storage for the Work library
  • for processing SAS libraries that have a high volume of input and output
  • as a cache for very large SAS libraries
Extended memory can be used to support memory-based libraries in 32-bit versions of the Windows Server 2003 Family and 32-bit versions of Server 2008. Conventional memory is used to support the MEMLIB and MEMCACHE system options in all other supported environments.
The servers allow multiple processes to access memory-based libraries simultaneously.
After you have completed the setup for your operating environment, you use the MEMLIB and MEMCACHE system options and the MEMLIB option in the LIBNAME statement to access memory-based libraries.

Setup Requirements for Using Memory-Based Libraries under Windows 2003 Servers and Later

The Windows 2003 memory manager can access up to 8 GB of physical RAM in the Windows 2003 Enterprise Server and up to 32 GB of physical RAM in the Windows 2003 Datacenter Server.
To use extended memory under Windows 2003 Servers or above, ensure that your operating environment meets the following requirements:
  • Intel or Intel-compatible 32-bit processor (Pentium Pro or later).
  • More than 4 GB of RAM; you might have better performance if you use 8 GB or more.
  • The parameter /PAE has been added to the server start-up line in the boot.ini file.
  • SAS 9.3 for Windows.
Then follow these steps:
SAS 9.3 for Windows uses the available memory to support the MEMLIB and MEMCACHE options.
CAUTION:
It is possible to exhaust system memory, and thus cause system failure.
You can use the MEMMAXSZ option to limit the amount of system memory that SAS allocates to the MEMLIB and MEMCACHE options.

Setup Requirements for Using Memory-Based Libraries under Windows XP Professional

Windows XP Professional is limited to 4 GB of physical RAM. Memory-based libraries are designed to optimize performance in server environments where more than 4 GB of physical memory is present. In these operating environments, conventional memory is used to support the MEMLIB and MEMCACHE options. Specifying these options in Windows XP Professional, Windows Vista, and Windows 7 environments might or might not improve performance.
To use memory-based libraries under Windows XP Professional, Windows Vista, and Windows 7 ensure that your operating environment meets the following requirements:
  • Intel or Intel-compatible 32-bit processor (Pentium Pro or later)
  • 4 GB of RAM
  • SAS 9.3 for Windows
Then follow these steps:
SAS 9.3 for Windows uses the available memory to support the MEMLIB and MEMCACHE options.
CAUTION:
It is possible to exhaust system memory, and thus cause system failure.
You can use the MEMMAXSZ option to limit the amount of system memory that SAS allocates to the MEMLIB and MEMCACHE options.

Specifying the MEMLIB and MEMCACHE Options in 64-Bit Windows Environments

Sixty-four bit processing in Windows operating environments uses 16 terabytes (TB) of virtual address space, so in these environments, extended memory is not needed. SAS uses the conventional memory that is available to support the MEMLIB and MEMCACHE options.
CAUTION:
It is possible to exhaust system memory, and thus cause system failure.
You can use the MEMMAXSZ option to limit the amount of system memory that SAS allocates for the MEMLIB and MEMCACHE options.
To use the MEMLIB and MEMCACHE options, ensure that the operating environment meets the following requirements:
  • Intel or Intel-compatible 64-bit processor (Itanium or later).
  • Any 64-bit version of Windows.
  • 4 GB of RAM or more; you might have better performance if you use more than 8 GB.
  • SAS 9.3 for Windows.
Then follow these steps:

Specifying the Local Security Settings

In 32-bit environments starting with Windows XP Professional and above, the Lock pages in memory security setting must be set, so that each user who is running SAS has access to the extended memory. If a user does not have the correct permissions, then SAS will issue a warning message to the log.
System administrators can set the local security settings through the Start Menu. To set this value
  1. Open the Control Panel.
  2. Double click Administrative Tools.
  3. Double click Local Security Policy. The Local Security Settings window will open.
  4. Double click Local Policies.
  5. Double click User Rights Assignment.
  6. Double click Lock pages in memory. The Local Security Policy Setting window will open.
  7. Click Add. The Select User or Groups window will open.
  8. Select the user IDs or name of the group of users who need to run SAS with access to the extended memory.
  9. Click OK in the Select User or Groups window.
  10. Click OK in the Local Security Policy window.
    Note: In the Local Security Policy window, you might see two check boxes: the Local Security Setting check box and the Effective Policy Setting check box. If the Effective Policy Setting check box is not selected for the users that you added, you will need to reboot your computer so that the new security settings will take effect.

Processing SAS Libraries as Memory-Based Libraries

SAS libraries that are well suited for memory-based processing have data that is referenced or updated multiple times within a SAS session.
Using a Work library that is memory-based is beneficial for procedures such as PROC SORT that write multiple times to large temporary files. To designate the Work library as memory-based, specify the MEMLIB system option when you start SAS.
You designate a library as memory-based by using the MEMLIB option in the LIBNAME statement. All librefs, including a libref to the Work directory, must have a valid disk directory.
After the library is designated as memory-based, your SAS program needs to copy the library from disk to memory. After processing the library in memory, the library must be copied back to disk.
CAUTION:
Copy the library that is in memory to disk after processing is complete.
If you do not, you will lose any changes that were made to the library. The changes are lost when the SAS session ends
The following example shows how to use the LIBNAME statement and the PROC COPY statement to copy a library to and from memory.
/* Set up two librefs, one to the library in memory
and the other to the SAS library on disk.  The library on 
disk contains dataset1, dataset2, dataset3 and dataset4. */

libname inmemory “g:\memlib” memlib;
libname ondisk “g:\disk”;

/* Copy dataset1, dataset2, dataset3, and dataset4 to memory   */

proc copy in=ondisk out=inmemory;
run;

/* ...Assume dataset1 and dataset4 are updated   */

/* Save the updated datasets back to disk         */

proc copy in=inmemory out=ondisk;
   select dataset1 dataset4;
run;
You can also copy a data set to memory by using a DATA statement, as shown in the following example:
data ondisk.dataset1;
   set inmemory.dataset1;
run;
For more information, see MEMLIB System Option: Windows and the LIBNAME Statement: Windows.

Using a Memory-Based Library as a SAS File Cache

A SAS file cache is most useful in multiple references of data. For example, a SAS file cache improves performance in SAS programs that make multiple passes of the data. SAS file caching improves performance in the following situations:
  • Repeated read operations of a file while other files are being written. Writing to a file clears the Windows file system (NTFS) cache.
  • Repeated read operations of a file when Scatter Gather I/O is active. Scatter Gather I/O operates outside the NTFS cache. Without the SAS file cache, there is no data cache and all read operations access the disk.
To use memory as a SAS file cache, specify the MEMCACHE system option when you start SAS or when you submit an OPTIONS statement. If you set MEMCACHE to 4, SAS uses the memory to cache all files. If you set MEMCACHE to 1, only files that are currently in memory are cached to memory. When you use the MEMCACHE system option in the OPTIONS statement, you can control which data sets use the SAS file cache, as shown in the following example.
/* Example of controlling cached files with the options statement   */

/* Assume cachelib contains 2 data sets, ds1 and ds2.               */
/* Also assume ds1 and ds2 are large enough that they cannot exist */
/* in the cache together. ds1 is read many times, so caching is     */
/* desired. ds2 is accessed only once, so caching is of no         */
/* benefit.  When you use the memcache option, ds1 is cached, and ds2   */
/* is not cached.                                                      */

libname cachelib "e:\tmp";

/* Turn on full caching */

options memcache = 4;

/* Read ds1 and place the data in the cache.  This read operation could be a  */
/* more useful read operation of the file in a real case.               */

data _null_;
  set cachelib.ds1;
run;

/* Change memcache setting to use the cache only for files that   */
/* already exist in the cache.                                    */

options memcache = 1;

/* Data from ds1 will come from the cache and ds2 will not be     */
/* cached.                                                        */

proc sort data=cachelib.ds1 out=cachelib.ds2;
  by j;
run;

/* Other access of ds1...                                         */

/* All use of the cache can be ended with a memcache system       */
/* option value of 0.                                             */

options memcache = 0;

/* Neither ds1 or ds2 will access the cache.                      */

proc sort data=cachelib.ds1 out=cachelib.ds2;
  by j;
run;
For more information about the MEMCACHE system option, see MEMCACHE System Option: Windows. For more information about Scatter Gather I/O, see SAS Features That Optimize Performance and SGIO System Option: Windows.