BookmarkSubscribeRSS Feed

Supercharging SAS Model Manager with CAS Gateway (Part 1: The Concept)

Started 2 hours ago by
Modified 5 hours ago by
Views 38

SAS Model Manager has been a centralized repository for governing analytical models, regardless of whether they are built in SAS, Python, or R. However, operationalizing open-source models at scale, scoring millions of records, often introduced friction. Historically, data had to move from high-performance storage into a Python environment, be processed, and then moved back. This data movement was often the bottleneck.

Enter CAS Gateway, a feature enhancement introduced in SAS Viya Long-Term Support (LTS) releases 2024.09 and leveraged by SAS Model Manager in 2025.01. It fundamentally shifts how Python and R models execute within the SAS ecosystem, moving from a centralized execution model to a distributed, parallel processing model.

 

In this three-part series, we will unpack this technology:

  • Part 1 (this post) explores the concept and architecture.
  • Part 2 explains how SAS Model Manager leverages this today (The “Comfort” Zone).
  • Part 3 explores how to unlock maximum performance using code (The “Power” Zone).

 

 

The Bottleneck: Serial Execution in a Parallel World

 

To understand the value of CAS Gateway, we first need to look at the architecture prior to the 2025.01 release for scoring open-source models in SAS Viya, often referred to as PyMAS (Python Micro Analytic Service).

 

In the PyMAS approach:

  1. Data resides in CAS (Cloud Analytic Services), SAS’s high-performance, in-memory engine.
  2. When a scoring job runs, CAS fetches data using a DS2 Wrapper.
  3. The data is serialized (commonly as pickled Python objects or other binary frames) and sent to the mas2py helper process (launched by DS2/PyMAS), which scores the data.
  4. Results are serialized back to CAS.

 

While excellent for real-time transactions (for example scoring one loan application at a time), this architecture struggles with batch jobs involving multi-millions of rows. The overhead of serialization and the single-threaded nature of standard Python interpreters create a “soda straw” effect, forcing a massive lake of data through a tiny pipe.

 

01_DE_supercharging-sas-model-manager-cas-gateway-page-1-1536x1388.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

 

The Solution: CAS Gateway

 

Starting with the 2025.01 stable release, SAS Model Manager adopted the CAS Gateway action set for performance monitoring and scoring tests of Python models.

The concept is simple but powerful: Bring the code execution to the data.

By doing so, CAS Gateway avoids the per-row marshalling and serialization overhead that limits the traditional PyMAS flow, making it a much better fit for high-volume batch scoring.

Instead of moving data out of CAS to a Python process, CAS Gateway can spin up a Python interpreter on each CAS worker node directly.

 

Key Architectural Differences

 

  1. Distributed Execution (MPP): If your CAS environment has 5 worker nodes, CAS Gateway can start 5 Python processes (or more, depending on configuration). The data never leaves the node where it resides.
  2. Shared Memory (Zero-Copy): It utilizes Apache Arrow to share memory between the C++ based CAS kernel and the Python process. This eliminates the expensive serialization/deserialization step.
  3. Scalability: Processing power scales linearly with your cluster size. To score 100 million rows faster, you simply add more CAS workers.

 

The Result: Performance Gains

 

02_DE_supercharging-sas-model-manager-cas-gateway-page-1c.png

 

The impact of this architectural shift is dramatic. In internal benchmarks and community reports, users have seen consistent, often substantial speedups, commonly multiple-fold reductions in execution time, though exact gains vary by model, data size, and cluster configuration; some isolated tests have shown larger reductions for specific workloads.

 

Here are some data points to highlight that explain the shift: At 35.8K records, the pre-2025.01 method takes 184 seconds whilst post-2025.01 it takes just under 9 seconds. Scoring 17.9 million records takes 75 seconds whereas a pre-2025.01 would have taken 10+ minutes.

 

Note: this diagram and the example numbers were derived from the SAS® Model Manager: Quick Start Tutorial and, more specifically, the “Evaluate and Deploy a Python Model” exercise in that tutorial. For transparency, the chart omits pre-2025.01 results beyond ~71k rows because the earlier release exhibited a flattening of benefits at larger sizes that would compress the visual differences; reported speedups therefore depend on model, data shape, and cluster configuration.

 

For an IT persona, this means:

  • Reduced Infrastructure Costs: Jobs finish faster, freeing up compute resources.
  • Simpler Architecture: No need to manage complex external container pools for batch jobs.
  • Standardization: Use standard Python libraries (pandas, scikit-learn, xgboost) without rewriting code for obscure parallel frameworks.

 

Next Up

 

This high-level overview explains why the CAS Gateway is a game-changer for open-source integration in SAS Viya. In Part 2, we will look at how SAS Model Manager exposes this feature. We will see how it intelligently wraps your model to gain the “Zero-Copy” speed benefits while maintaining a simple, predictable execution model.

 

TL;DR, Prerequisites, and Security

 

TL;DR: CAS Gateway brings Python/R execution to the CAS worker nodes using zero-copy Apache Arrow memory sharing. It removes per-row serialization overhead and gives large batch scoring significant speedups, use the default single-node mode for safety and switch to distributed mode only for extreme scale and stateless code.

Prerequisites: - SAS Viya LTS 2024.09 or later and SAS Model Manager 2025.01+. - Python 3.10+ with pandas, pyarrow, and swat available on worker images. - Permissions to run the gateway action set and to deploy model resources to CAS worker nodes.

Security / Trust note: Only run models and pickle files from trusted sources. Loading pickles or executing arbitrary code on CAS worker nodes can be unsafe; scan artifacts, review code, and use signed or vetted model bundles when possible.

 

Find more articles from SAS Global Enablement and Learning here.

Contributors
Version history
Last update:
5 hours ago
Updated by:

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags