SAS Administration: Change the Options to Get More Performance
Every time I install SAS products or solutions I find myself using the same options in the SAS configuration file to set memory usage, CPU usage, and the SAS WORK library location. Obviously each installation has different thresholds configured but the options remain the same. In some situations not having the performance options set can lead to problems if you’re working with large datasets or building a big OLAP cube. Having the ability to set the SAS WORK library to a different location is also beneficial if you have separate storage options. You can also improve the general performance of the SAS server by configuring and tuning options to meet your needs. As always, check with your SAS or IT administrator to see what capabilities exist and how you can maximize these options!
Typical SAS Server Configuration Options
Here is the typical configuration I copy and paste into every SAS configuration file:
Configuration files can be found all over the place. I typically change these two files:
- [SAS HOME]/SASFoundation/9.3/sasv9_local.cfg
SAS Support has plenty of documentation on the order of precedence for SAS configuration files.
Important Note: Add options to the “usermods” version of configuration files as a general best practice. Doing this will prevent SAS from overwriting when software is upgraded.
Important Note 2: Every operating system environment is different and may have different options. For example, Windows uses a different file system path than UNIX/Linux. This blog post uses Linux x64 operating environment.
Setting the SAS WORK Library Location and Default Permissions
If you have the option of mounting additional space or hard disks for your SAS WORK library you can set the library location using this parameter. The SAS WORK location is one of the most intense areas of activity in terms of IO throughput because practically every SAS process uses the WORK library for temporary data needs. Segmenting this activity on a dedicated mount point is ideal for maximum WORK library performance.
In some cases, it may be necessary to set the default file system permissions for the SAS WORK library when information is written. Use the ‘workperms’ option to configure this.
Check out SAS Support for more documentation on setting the WORK library location and setting the default WORK library file system permissions.
Setting Utility File Location
As it is beneficial to segment hard disk IO for the SAS WORK library location, the same goes for utility files generated by using SQL operations. This area of the file system can become very intensive during heavy data processing just like SAS WORK.
Additional documentation is available for the UTILLOC system option at SAS Support.
Setting the Number of CPU Cores and Enabling Threading
Another good practice is to let SAS know how many CPU processors exist in your environment and if these processors support multi-threading. In my opinion, for large production environments it is better to limit how many CPU cores SAS uses, especially if threading is enabled, to prevent over-loading the system. It’s a conservative approach but I would rather be safe and scale up from theree. For example, I generally limit the number of cores to 25-50% of the actual number of cores. Otherwise as the load increased, SAS can potentially consume all available CPU cores and impact overall performance for other users. For my own development environment, since I am the only user, I allow access to all CPU cores.
Only certain SAS procedures take advantage of threading and parallel CPU activity. I typically see improvements using the PROC SORT and PROC SQL steps.
Setting Memory Options for SAS
These are a few memory options which should be configured together. Use these options to limit the amount of memory SAS has available per process. A good practice I follow, which was passed on through SAS Tech Support troubleshooting, is to set the REALMEMSIZE, SUMSIZE, and SORTSIZE to approximately 75% of the total MEMSIZE.
Check out SAS Support for more documentation on configuring memory options. SAS Support also has good context on MEMSIZE and UTILLOC in this usage note.
Setting Buffer Size for Writing SAS Datasets
The last option I typically set is the buffer size for writing SAS datasets. You want this to be greater than or equal to the file system block size for where SAS datasets are written. The larger the buffer size for SAS datasets, the less SAS has to read or write to the physical storage device. This comes at a cost of consuming more physical memory. Larger buffer sizes should be in multiples of the file system block size to minimize how many times SAS has to access the file system. I typically go with values between 4K to 256K depending on the environment and how hardware is configured. Collaborating with the IT systems administrator is important.
As always, check out SAS Support for more documentation on setting the buffer size. Also read this technical support paper for increasing IO throughput – has a lot of good low-level detail!
Display Current SAS Options
Here is a quick line of code that will show you your current SAS configuration in the log:
proc options; run;
You can add the “performance” parameter to focus just on performance related options:
proc options group=performance; run;
Hopefully these options will at least open some people’s eyes to simple options which can drastically improve performance or prevent problems. A key to success for these performance options is to work directly with the IT systems administrator of the environment to ensure proper setting for each option.
Please reply with any additional useful options and the situations you have used them for!
You can learn more about SAS Business Intelligence from the "SAS BI Bible." Take a peek inside the Building Business Intelligience with SAS book.
Latest posts by Steve Overton (see all)
- Need to Migrate Users, Groups, and Roles between SAS Environments? - November 5, 2013
- Big Data Loading with PostgreSQL available in SAS 9.4 - October 22, 2013
- Everything Still Starts and Ends with Data in SAS Visual Analytics - July 30, 2013
- Coding: Quick Tip for Exploiting and Identifying SAS Formats - July 15, 2013
- Describe Your Table in SAS to Write the SQL Code - May 22, 2013