Azure / RDS-Templates

ARM Templates for Remote Desktop Services deployments
MIT License
468 stars 601 forks source link

AutoScale Fall 2019 - SessionThresholdPerCPU math - 4a-WVD-scaling-logicapps #523

Closed WVDHERE closed 3 years ago

WVDHERE commented 3 years ago

WVD AutoScaling issue.txt

We have a Pool of 6 sessions (VMs) sized with Standard F8s_v2 (8 vcpus, 16 GiB memory). The host pool is configured for Breadth First and we have a Max. Session Limit of 4. Accounting for hyper-threading we should be dealing with 4 actual cores instead of 8. Our question is around the variable SessionThresholdPerCPU. We currently have that variable set to 1 - Is that correct? The math for setting that variable is very unclear and does it matter what number we put for that variable? We want to make sure that if say we have 2 hosts running, and we have users logging in, that when we reach 6 or 7 total users on both sessions that another session will begin to start before both hosts completely fill up.

We've attached logs as requested but bellow is some of the output we see when we have users log in:

Number of user sessions is more than 90 % of the max number of sessions allowed with minimum number of running session hosts required (7). Adjusted minimum number of running session hosts required to 3

Number of user sessions per Core: 0.3125, threshold: 1

Also, in the script the number we use for the variable SessionThresholdPerCPU - can it be a fraction or does it have to be a whole number?

nakranimohit0 commented 3 years ago

@WVDHERE

Doc: https://docs.microsoft.com/en-us/azure/virtual-desktop/virtual-desktop-fall-2019/set-up-scaling-script#how-the-scaling-tool-works

"During peak usage time, the job checks the current number of sessions and the VM capacity of the current running session host for each host pool. It uses this information to calculate if the running session host VMs can support existing sessions based on the SessionThresholdPerCPU parameter defined for the CreateOrUpdateAzLogicApp.ps1 file. If the session host VMs can't support existing sessions, the job starts additional session host VMs in the host pool"

SessionThresholdPerCPU can be fractional such as 0.33

" Note SessionThresholdPerCPU doesn't restrict the number of sessions on the VM. This parameter only determines when new VMs need to be started to load-balance the connections. To restrict the number of sessions, you need to follow the instructions Set-RdsHostPool to configure the MaxSessionLimit parameter accordingly."

"During any time, the job also takes host pool's MaxSessionLimit into account to determine if the current number of sessions is more than 90% of the maximum capacity. If it is, the job will start additional session host VMs"

The tool considers 1 vCPU = 1 core. So if you'd like to have 4 user sessions per 8 core VM, you can set SessionThresholdPerCPU = 0.375 in which case during peak hours, 4th user login will trigger the tool to start another VM.