We have created a new reusable context server with a shared account linked to it for our web application running within the job execution server. This should be good for the performance of our application.
I have been looking at the session id's within the log during the usage of our created web form. My assumption is that the session ID should be the same for a period of time.
The session ID ends with '-000X' and seems to get a higher number after each action (processing form).
What does this last part mean? Is this still the same session or should we interpreted this as a new Session?
There seems to be a little bit performance improvement, but not allot.
My theory on this is that the reusable context "reuses" a (parent) SAS session for each of the "sas00xx" (child) sessions. That parent session will have already run the autoexec, and have the options set, making the creation of each child session much faster.
The reason you are seeing new session ids is likely because you are creating new sessions with each request (expensive / still quite slow). If you want to re-use a specific session, you need to connect to that particular session id (they last 15 minutes without activity by default).
Connecting to an existing session is much faster than creating one each time - which is why, in the SASjs Adapter, we pre-spawn sessions for subsequent use (providing sub-second response time if everything is set up correctly).
That's right, SASjs uses a 'session array' and spawns additional sessions as they are popped off. It also kills the sessions after they are used, which is more efficient than leaving it running for 15 minutes.
If you want to to re-use a single session you just need to post to the `/compute/sessions /$sessionid/jobs ` endpoint, eg: https://github.com/sasjs/adapter/blob/master/src/api/viya/executeScript.ts#L157
We are using a html form post request where we use the SASJobExecution/jobdefinitions/definitions/...... url.
In your documentation you refer to that as the JES API approach.
Within the Webapp I would indeed like to re-use a single session. Is there an approach I can take while still using the html webform and the JES API.
I have looked into the approach of using the compute api but that would mean re-coding the total webapp which is mainly build using SAS and HTML coding. I was hoping I could create a session (or determine the session on open) and reuse the session ID when the form action is initiated and the JES API is used.
Mixing HTML / JS code with SAS is an antipattern - I would not recommend it, for many reasons:
When we built the JES API approach (documented here: https://adapter.sasjs.io/#using-the-jes-api ) it was not possible to re-use session ids, perhaps that has changed now, if so I hope that this thread will be updated.
To my understanding though your performance gains will be limited to the use of a re-usable compute context - meaning best case 2 seconds on Viya 3.5 and 6-8 seconds on Viya 4.
Contrast with Compute API which is ~1 second - https://adapter.sasjs.io/#using-the-compute-api
The gains we got from a re-usable compute context on Viya are indeed what you are saying. Although it's a big difference our webapp is still way to slow after moving from a 9.4 STP to the JobExecution on Viya.
What would be a way to interact with a form/table? Do you have any suggestions? What approach would you take for a webform?
We now have a webform where users have to filter the data so the table has max 800 rows (due to browser performance) and then they will be able to changes values and write those results.
I'm afraid we will move back to Excel if the performance remains as is.
Here is a suggested architecture. Put the SAS data read behind a web service so it is isolated. I have used ASP.NET to do this and it works great. SAS is ODBC/OleDB compliant so use one of those behind the web service.
I front using Blazor since it can use a local component to display the data. WebAssembly is beyond screaming fast. Blazor can play video games over the web, it is that quick. Blazor then becomes the UI. If you want to use something like React, you could do that too.
Allan is right about the challenges with finding people to do both but find a UI person and then can interact with SAS. SAS is easy to deal with for a competent C# (or whatever) developer.
Have you considered just using Data Controller for SAS? https://datacontroller.io
We recently changed the pricing, so it is now free for unlimited users: https://datacontroller.io/pricing
Would be happy to shadow a deployment. Thanks to our OEM licence of the HandsOnTable grid system, it can handle on-page editing of several thousand rows (per data page), even hundreds of columns. For excel uploads, it can be tens of thousands, or more if you have a powerful PC. For CSV uploads there is no limit, as the processing is done backend in SAS.
We have multiple customer references, including banks / government / insurance if needed. The source is also available, you can build it yourself - https://git.datacontroller.io
The datacontroller looks interesting.
I would like to see the effect of using the compute api within our environment. That is why we started testing with the example of the sasjs adapter.
We saw the effect of your bar chart example on youtube and wanted to replicate that with the code you provide. We are able to have it working with the use of the SASJobExecution, but not with the Compute API.
When looking at the API call within the browser I can see the 400 return code.
When running the same API call within SAS Studio I see the same issue occurring multiple times. To me that seems like SAS has a problem with the quotations marks. Do you see how we can get this example working on Viya 2023.06?
205 " XATTR=ZDSATTR(XIDNM, 'ALL'); "
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended.
206 " XATTRN=ZDSXATT(XATTR); "
207 " "
208 " do j=1 to xattrn; "
205 " XATTR=ZDSATTR(XIDNM, 'ALL'); "
ERROR 22-322: Syntax error, expecting one of the following: ;, AUTH_ANY, AUTH_BASIC, AUTH_NEGOTIATE, AUTH_NONE, AUTH_NTLM,
CLEAR_CACHE, CLEAR_CONN_CACHE, CLEAR_COOKIES, CT, EXPECT_100_CONTINUE, FOLLOWLOC, HEADERIN, HEADEROUT, HEADEROUT_OVERWRITE, HTTP_TOKENAUTH, IN, MAXREDIRECTS, METHOD, NOFOLLOW, NOFOLLOWLOC, NOPROXY, NO_CONN_CACHE, NO_COOKIES, OAUTH_BEARER, OUT, PASSWORD, PROXYHOST, PROXYPASSWORD, PROXYPORT, PROXYUSERNAME, PROXY_AUTH_BASIC,
PROXY_AUTH_NEGOTIATE, PROXY_AUTH_NONE, PROXY_AUTH_NTLM, QUERY, TIMEOUT, URL, USERNAME, VERBOSE, WEBAUTHDOMAIN, WEBPASSWORD, WEBUSERNAME.
209 " XATTRC=ZDSYATT(XATTR, j); "
210 " blank_pos = index(xattrc,\" \");"
211 "\t\t key = substr(xattrc, blank_pos,99);"
I'm not able to change the " XATTR=ZDSATTR(XIDNM, 'ALL'); code because it's not within the Job.
Interesting. This code is not within SASjs either.
Perhaps we can schedule a call to take a look? I'd be happy to help, if I can. https://4gl.io/cal
Am also free for the rest of today if you want to send me a PM.
Great to chat, we're on the case in relation to the root cause, the issue can be tracked here: https://github.com/sasjs/adapter/issues/829
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.