CAS

Transferring In-Memory Data Between CAS Servers

Simon 24/03/2021 6 views

With the evolution of the SAS© Viya architecture, the need to move in-memory data from one CAS server to another (for example, during a migration between two Viya environments or two different Kubernetes namespaces) has become crucial.

Previously complex, this operation is now simplified thanks to a specific type of library: the CAS-type Caslib (srcType="CAS").

The Concept: A Bridge Between Two Memories

Traditionally, a caslib points to a physical source (a system folder, an Oracle database, etc.) and loads data into memory. The novelty here is to define a caslib whose source is not a disk, but the memory of another CAS server.

This allows data to be copied directly from server to server via native SAS© tools, without going through intermediate file exports and without requiring the complex intervention of a Kubernetes administrator.

Use Case: Migration Between Environments

Imagine you need to migrate in-memory tables from a source environment (e.g., "From35") to a target environment (e.g., "Target"), located in two different namespaces.

Here is the 3-step procedure to perform this transfer cleanly:

Step 1: Create the "Bridge" (The Transfer Caslib)

On your target environment, you will create a special caslib. It will act as a tunnel to the source environment.

1CAS transfersess;
2PROC CAS;
3 /* Création de la caslib 'transfer' qui pointe vers la source */
4 TABLE.addcaslib /
5 name="transfer",
6 dataSource={
7 srctype="CAS", /* Le type magique */
8 user="mon_user",
9 password="mon_password", /* À encoder de préférence ! */
10 cashost="controller.source-env-host", /* L'adresse du contrôleur source */
11 caslib="VAModels" /* La caslib source à lire */
12 };
13QUIT;
Note: The cashost corresponds to the hostname of the source CAS controller (retrievable via the CAS configuration).

Step 2: Load the Data into the Target Memory

The tables from the source environment are now visible via the transfer library. You just need to load them into the memory of your final destination library (e.g., VAModels on the target).

1PROC CAS;
2 /* Copie de la table de 'transfer' vers 'VAModels' locale */
3 TABLE.loadtable /
4 caslib="transfer"
5 path="MA_TABLE_SOURCE"
6 casout={caslib="VAModels", name="MA_TABLE_CIBLE", promote=TRUE};
7QUIT;

Step 3: Persist the Data (Physical Backup)

The data is now in the new server's memory, but it will disappear upon restart if it is not saved to the local disk of the new environment.

1PROC CAS;
2 /* Écriture physique sur le disque de la cible */
3 TABLE.save /
4 caslib="VAModels"
5 name="MA_TABLE_CIBLE"
6 TABLE={caslib="VAModels", name="MA_TABLE_CIBLE"}
7 replace=True;
8QUIT;

Using srcType="CAS" offers an elegant and 100% SAS© method for "teleporting" data between deployments. It is an indispensable tool for modern SAS© administrators managing distributed architectures or Cloud migrations.