Which service/process deems when to kill an ongoing AppStream session?

0

In some earlier answers, I've been told that there's an AppStream Agent running during the session. But I cannot find it in the Windows Task Manager. I've found PhotonWindowsCustomShell, PhotonAgent, and some other SSM and CloudWatch agents.

  1. Which process evaluates if the session reached Disconnect or Idle Timeout?
  2. Is there a way to communicate with that process and hinder it from killing the instance if our app is above a certain CPU utilization threshold?
已提问 1 年前382 查看次数
3 回答
0

You could try, if you can emulate keyboard or mouse movement to keep the session active. You can register a powershell script to be called regularly (maybe once every 10 minutes) and move the mouse by 1 point.

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)

This could be done conditionally (on high CPU-load only). That should not interfere with the user too much.

Get-WmiObject Win32_Processor | Measure-Object -Property LoadPercentage -Average | Select Average

However, I am not sure, if that approach to programmatically move the mouse keeps the session alive. That would need to be tested.

已回答 1 年前
  • Yes, we've tried that. We have a PowerShell script running and evaluating CPU utilization and when thresholds are breached we've tried both with keyboard input ($WShell.sendkeys()) and mouse movement (New-Object System.Drawing.Point()) but it's not working. We're evaluating the Idle state from Win32 API GetLastInputInfo. Any idea why Photon Agent doesn't pick up those inputs?

  • What is your use case? Is changing the timeout value to higher number not an option as mentioned in our documentation suggested by StevieStets below.

  • Okay, then one more idea. It appears, you can prevent appstream from disconnecting idle users. Quote from CLI command here: https://docs.aws.amazon.com/cli/latest/reference/appstream/create-fleet.html: --idle-disconnect-timeout-in-seconds: To prevent users from being disconnected due to inactivity, specify a value of 0. Otherwise, specify a value between 60 and 3600. The default value is 0.

    Then what you could do is disable that automatic idle disconnect handling. You can then - if you need to - find some other way of deactivating an ongoing session. We are for instance using expire-session to kick out users, where their "prepaid usage-amount" has been completely consumed (this is some value managed by us). We have a shell script via cron within each client, which checks that usage amount and in case this falls below zero, this script calls expire-session for the current client (that's Linux, but it should also work in Windows clients).

  • Our client will have basically two types of users: 1st working 8-10 hours a day, 2nd uses instances for long-term calculations that can take more than 12 hours (often longer, no user activity). Our client doesn't want to differentiate customers and create an additional fleet because we already have two different stream.graphics-design fleets. So disabling Idle and setting up the Disconnect timeouts for say 18 hours will lead to unutilized resources among the first group of users. That's why we're looking for a solution that would hinder the session termination based on actual CPU usage.

0

I would not recommend trying to change the behavior of the session timers beyond what is documented. https://docs.aws.amazon.com/appstream2/latest/developerguide/set-up-stacks-fleets.html#set-up-stacks-fleets-create

AWS
专家
已回答 1 年前
0

Hello,

Photon Agent is responsible for communicating the session state to the backend service. You can't interfere or communicate with the process to extend the session.

The session is considered active only if there is keyboard and mouse interaction, otherwise the session is considered idle and idle timeout will trigger. CPU utilization on instance isn't considered active session. Once the idle timeout value expires, the session is disconnected. Next, the backend service evaluates the "Disconnect Timeout", if it has expired the session is terminated.

AWS
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则