BookmarkSubscribeRSS Feed
brendanb
Obsidian | Level 7

Hi, I am migrating a 9.4 stored process application to JES Web Application on Viya 3.5.

Previously we made use of stp sessions (_SESSIONID:Stored Process Server:Specifies a unique identifier for the session. The _SESSIONID variable is created only if a session), where we explicitly create a session at startup and then used the _sessionid in our urls to ensure the user reuses and runs within the same session. This made would also check for existing query results tables to avoid researching/rerunning queries as the user flips between screens/tabs (i.e. we would look for table cus12345, if it exists then we would display and not rerun the query). When sessions were created we used the save library (created for you when the session was created) to store the tables.

So now in JES Web Application, we need to so the same.

1. Ensure a session is created (i have used the cas function to create the session which generates the UUID for me)

2. Reuse the session, put the UUID in _IOCASEUUID_ variable similar to use of _sessionid, but this does not work

3. re-use existing session tables (previous save library). I have not found similar so making use of the work folder. Effectively i need to ensure the session data is not trashed so I can reuse.

Please assist.

 

Hope this makes sense 🙂

Thanks in advance.

Brendan

4 REPLIES 4
AllanBowe
Barite | Level 11

Hi Brendan - I'm not aware of an equivalent for sessions as they were in SAS 9 (perhaps someone will correct me).  In general I would say they are bad practice as it makes services harder to test and has an additional server side cost.  Services should, in general, be stateless.

 

It WOULD be possible for you to use the APIs to spin up a compute session and re-use that state.

 

Or, you could write your temporary results to a permanent library, and access it again later (for this you'll need some kind of cleanup mechanism)

 

If you are rebuilding an STP web application onto Viya JES I would highly recommend taking a look at the open source framework we built - it's a serious accelerator to these kinds of projects.

 

https://sasjs.io

 

 

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
brendanb
Obsidian | Level 7

hi, thanks, will check it out.

also found this in terms of re-using sessions : 

 
AllanBowe
Barite | Level 11
The link you shared is about reusing server processes, which is a “vanilla”
(plus autoexec) session that is prelaunched to improve responsiveness

You definitely want this as it will bring request response times from 6-8
seconds to 2-4

If you want sub second responsiveness, you can try the sasjs/adapter
/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
brendanb
Obsidian | Level 7
thanks, will check this out as well.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1465 views
  • 2 likes
  • 2 in conversation