Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Am trying to fetch the info of Time Taken by App to load to cache memory when its launched in qliksense. I dint find related information in AppIdentifier class objects in qliksense.Engine. should i refer any other extensions/namespace to get this? this am trying to get for monitoring purpose.
Thanks!
If you mean that you want to check the time it takes to load the app from disk to memory in a cold cache environment, then I'm pretty sure you can't get that information from the engine API. But if you set QIX performance logs on the engine node to "Debug", then you will get more detailed information about the time it takes to execute different endpoints (including "OpenDoc") on the engine side. That would mean you would have to read the log files to get the information, so the SDK won't help you there. And distinguishing cold cache from warm cache openings is still rather tricky, as the process of opening apps is a rather complicated operation.
A pragmatic approach that I typically do to track app open time is simply to add a stopwatch around the OpenApp call in the sdk like this:
using (var hub = location.Hub())
{
var sw = new Stopwatch();
sw.Start();
var app = hub.OpenApp(appId.AppId);
sw.Stop();
Console.WriteLine("Time to open app: " + sw.Elapsed);
}
Both of them will open the app, but the call to location.App will also initialize the websocket (with authentication and all of that flow) before opening. The call to hub.OpenApp, on the other hand, is a direct wrapper for this engine endpoint:
https://help.qlik.com/en-US/sense-developer/April2020/APIs/EngineAPI/services-Global-OpenDoc.html
So with the approach I described in the earlier comment, all the communication setup is done by the call to location.Hub, and the stopwatch will just be measuring the time it takes to call the engine endpoint for loading the app.
But your 8 second difference sounds like a lot. Remember that the time to open an app will depend heavily on whether or not the engine has already been loaded it into the engine memory when you open it. That's why I mentioned the cold cache/warm cache problem earlier. To get a warm cache measurement you should probably call hub.OpenApp twice in a row. If you still see that 8 second difference between location.App and hub.OpenApp, then you might want to check if there's something out of the ordinary in the authentication mechanism used for you Qlik Sense installation.
If you mean that you want to check the time it takes to load the app from disk to memory in a cold cache environment, then I'm pretty sure you can't get that information from the engine API. But if you set QIX performance logs on the engine node to "Debug", then you will get more detailed information about the time it takes to execute different endpoints (including "OpenDoc") on the engine side. That would mean you would have to read the log files to get the information, so the SDK won't help you there. And distinguishing cold cache from warm cache openings is still rather tricky, as the process of opening apps is a rather complicated operation.
A pragmatic approach that I typically do to track app open time is simply to add a stopwatch around the OpenApp call in the sdk like this:
using (var hub = location.Hub())
{
var sw = new Stopwatch();
sw.Start();
var app = hub.OpenApp(appId.AppId);
sw.Stop();
Console.WriteLine("Time to open app: " + sw.Elapsed);
}
Thanks @yko for providing alternative soln. Can you please suggest which is the proper method to open a App with Data. Is it hub.OpenApp() or location.App(appIdentifier, noData: false). what is the difference between them in the way of working. I get huge difference (atleast 8sec) in time when both were tested for taking App Loading Time.
Both of them will open the app, but the call to location.App will also initialize the websocket (with authentication and all of that flow) before opening. The call to hub.OpenApp, on the other hand, is a direct wrapper for this engine endpoint:
https://help.qlik.com/en-US/sense-developer/April2020/APIs/EngineAPI/services-Global-OpenDoc.html
So with the approach I described in the earlier comment, all the communication setup is done by the call to location.Hub, and the stopwatch will just be measuring the time it takes to call the engine endpoint for loading the app.
But your 8 second difference sounds like a lot. Remember that the time to open an app will depend heavily on whether or not the engine has already been loaded it into the engine memory when you open it. That's why I mentioned the cold cache/warm cache problem earlier. To get a warm cache measurement you should probably call hub.OpenApp twice in a row. If you still see that 8 second difference between location.App and hub.OpenApp, then you might want to check if there's something out of the ordinary in the authentication mechanism used for you Qlik Sense installation.
In Continuation with above question, am trying to measure cold cache of Application so that i will get idea of Apps that takes longer time to open. For doing this , i also need to consider fact that there might be active session for apps already running . So am just trying to flag if App is already there in cache or not.
For doing this am referring location.AppWithId(appUID).ConnectedUsers, but i see when i have kept opened the same app in hub which am calling in code, it still shows 0. Is there something to be considered or a better way to check if app is there in cache already?
And Thank you @Øystein_Kolsrud for your detailed explanation for my previous questions. It helped me a lot as am a beginner for .net sdk.
The AppIdentifier instance returned by AppWithId actually represents the data structures returned by this engine method:
https://help.qlik.com/en-US/sense-developer/June2020/APIs/EngineAPI/services-Global-GetDocList.html
And the comment for the property qConnectedUsers of DocListEntry simply states "Not used.". I believe this is some legacy property that was abandoned a long time ago. In fact, the recommendation is to not use GetDocList at all, but to get that type of information from the repository REST API.
But back to what you are trying to achieve. Have a look at this page:
That call will give you information about which apps are loaded into memory.