Is there a way to prevent instances from terminating?

0

We are building a solution for an application that sometimes needs to process data for 2-3 days. On the other hand, we don't want all users to have the same Disconnect Timeout of 72 hours or more. We know that one solution could be to use two fleets with two timeouts, but I wonder if there is a way for our application to stop the session ending? How does AppStream kill sessions? Is there any way to block a session kill attempt if the application is processing data?

  • @Mayank_J You write "Unless your application is capable of keeping the session active" what does that mean? If application is processing data (which doesn't involve human interaction, so there won't be any inputs) does that process count as alive? I mean, if one uses AppStream for generating videos that counts as a active process and session wouldn't be stopped, right?

  • Running process on OS is not equivalent to active session. Your processes can still run even if the session is in disconnected state (similar to locking a physical machine). If you run the command "query session" on the OS you can check the session state. This is what is monitored to check the status of the session. Unless there is an active interaction with the session like keyboard and mouse interaction, the session is considered idle. Once the idle time out expires, the session will be disconnected and once the disconnect time out expires, the session will end and the instance will be terminated.

  • I don't know, if that would work and it feels more like some hacky thing. But maybe you can write a powershell script and have it run regularly via task scheduler. That script could:

    • Check the CPU load
    • Check the idle time of that machine
    • If CPU load is high and idle time is above a particular threshold: Move the mouse to emulate being active ... don't know if that actually counts for AppStream to not kick out users from that instance. Of course, the streaming session would probably need to stay open for that whole duration.

    We did something similar not to extend the life of a session, but to shorten it (via aws appstream expire-session call, when a particular budget has been used up)

  • Hey @Mayank_J! Thanks for your answers. But can I ask you what do you mean by running the "query session" command? Is it possible to that query during the session (I mean without Admin permissions)?

profile picture
Les
asked a year ago894 views
2 Answers
0
  • Maximum session duration that you can set in the AppStream 2.0 console is 5760 minutes (96 hours)
  • Idle disconnect timeout in minutes, the amount of time that users can be idle (inactive) before they are disconnected from their streaming session. Users are considered idle when they stop providing keyboard or mouse input during their streaming session.
  • Disconnect timeout in minutes time interval begins after Idle disconnect timeout provided ends. Users are notified before they are disconnected due to inactivity. If they try to reconnect to the streaming session before the time interval specified in Disconnect timeout in minutes has elapsed, they are connected to their previous session. Otherwise, they are connected to a new session with a new streaming instance. Setting this value to 0 disables it. When this value is disabled, users are not disconnected due to inactivity. Refer https://docs.aws.amazon.com/appstream2/latest/developerguide/set-up-stacks-fleets.html
AWS
answered a year ago
  • I understand the concept of Disconnect Timeout. Let me rephrase my question: How does AppStream agent evaluate if session is active? Is it based on CPU utilization since for data processing no user input is neccessary (imagine video rendering)?

  • Appstream service communicates with the Appstream agent on the fleet instance and monitors the session on the streaming instance.. When a particular timeout is reached the service performs the action, that is disconnect, end session etc.. The Appstream service is not aware of what's happening at the OS level wrt to your application. Unless your application is capable of keeping the session active, there is no way to change this behavior. The only solution is to use multiple fleets.

  • Appstream uses different mechanism to check the session status, I believe Windows API and it is not based on resource consumption.

0

Would it be possible to prevent the instance termination with help of After Session Script? Maybe by checking the CPU utilization? Is it possible to monitor utilization from session? Does it need admin permissions? after

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions