in this video I go over session host load balancing with Windows virtual desktop
hello I'm Travis and this is Ciraltos in this video I go over load balancing
in Windows virtual desktop load balancing is the way requests are
directed to a pool of resources in this case load balancing refers to how
connections are distributed across the pool of session host computers in
Windows virtual desktop this video goes over the two methods of load balancing
offered by Windows virtual desktop breadth-first and depth-first before
that please take a second to subscribe and makes Toby happy and Toby's had a
rough week he could use some cheering up moving on breadth-first load balancing
is the default for newly created Windows virtual desktop host pools this method
distributes user connections across all the available hosts when a new
connection comes in the connection is directed to the session host with the
least number of active connections with breadth-first setting the max number of
connections per host is optional here you can see how connections get
distributed across the session hosts as users log in you can also see how
disconnected users are reconnected to existing sessions despite the number of
connections on that computer disconnected sessions are also
reconnected if the computer is set not to allow new connections
up next is depth-first load-balancing depth-first maximises connections to one
session host before moving new connections to the next if multiple
servers are running and have connections new connections will go to the server
with the most connections first up to the maximum number of connections for
that host for this to work a maximum number of connections per session hosts
must be set the number of maximum connections can be different for
different host pools but will be the same for all VMs in a host pool here's
an illustration let's say the max number of connections on a session host is 4 so
I can keep this PowerPoint animation simple one server will fill up first
before moving on to the next like breadth-first
the session gets disconnected it will reconnect to the host this prevents data
loss due to orphan connections depth first has the potential to save money by
only utilizing the servers needed for example those two servers on the right
are not doing anything it could be deallocated to save some money to realize
any savings though there would need to be a mechanism to start and shut down
servers dynamically the Microsoft Doc's references a script that does that but
it's fairly complicated and requires a dedicated server to run on I suspect
we'll see a better solution for dynamically starting and stopping VMs in
the near future as mentioned previously both depth-first
and breadth-first will reconnect user sessions even if the session host is set
not to allow new connections speaking of that hosts can be set to disable new
connections with the allow new sessions attribute on the session host this will
not log out existing connections just prevent new ones also load-balancing
only applies to pooled host pools personal host pools have a one-to-one
mapping and don't require load balancing one more thing I noticed the Microsoft
documentation indicates that breadth-first distributes connections to
provide the best user experience this in my opinion is not the right way to size
a remote desktop environment the host pool should be sized to accommodate the
max number of users per host whatever that number of users is for example if
an organization has a hundred potential users for a host pool they could deploy
10 smaller hosts allowing 10 connections each in depth first mode or four large
hosts that allow 25 connections each in breadth-first from the users perspective
the load balancing method should not matter I guess what I'm saying is that
if the max number of users allowed on a session host in a pool does not provide
a good user experience there's a problem with sizing or technology not the load
balancing method moving on to the demo I'm gonna walk through viewing the
existing breadth-first configuration configure depth-first and disable new
sessions okay buckle up everyone it's demo time so the first thing I'm going
to do is login and I actually did that before I hit record and the next thing
I'm going to is come up to these two variables I'm
just gonna run them to set my host pool name and tenant name so I'll just run
those real quick that just makes running future commands easier speaking of that
I'll have all these commands available on my website I'll include the link
below the next thing I'm gonna do is look at the current status of the host
pool and I do that with the get RDS host pool command oops here you can see it's
set to breadth-first and the maximum session limit is 999,999 so that would
be for unlimited number of sessions next I want to look at the session host so
I'm gonna use the get RDS session host command and I just run this selection
here you can see gives me details about both of my session hosts I do want to
see that in a different format though all I want to see is the session host
name sessions and allow new session setting so I'm gonna take that command
and pipe it into a format table that looks better so I have two session hosts
neither of them have sessions and they are both allowing new sessions with this
set to breadth-first I'm gonna log in to a couple remote desktop sessions and
we'll see what happens I'm now signed on to to remote desktop sessions let's see
what this looks like now here it is the number of sessions is one each that's
because breadth-first distributes the connections across all available session
host so I have two - logged in one each next I'm gonna use the set RDS session
host command to set the session host that ends in a -1 to not allow any
new sessions this will disable any new sessions this is a good option if you
want to take servers out of service at but you don't want to kill any existing
connections you can disable new connections people will bleed off as
they log out and then once everybody's logged out you can do maintenance on it
or whatever needs to be done there it is and you can see allow new sessions is
now set to false let's just look at that grid again there it is so now you can
see new sessions are set to false so what happens now if I log in a couple
more times I'm now logged into a total of four so let's run this command again
and here you can see although it's breadth-first the first session host
took the additional two for a total of three while the other one just stayed at
one it didn't log off the session that was in there but it's not taking anymore
so that's exactly what we would have expected so I'm gonna set this to true
so it allows new connections and we're gonna move on next I'm gonna run get RDS
host pool again and just see where we're at here okay we're set still set to
breadth-first with 9999 thousand connections the next command the set RDS
host pool is going to set the whole spool the depth-first with a maximum
session limit of two to is pretty small these are small VMs but more than
anything I just want to demonstrate without having to log into a bunch I'm
gonna run this command now my session host pool is set to depth first with a
maximum of two connections I'm gonna log into to remote desktop sessions and
let's take a look at how those get distributed now that weren't depth first
mode all right I'm now logged in twice let's see what this grid looks like
unlike breadth-first that distributes the sessions between the session host
depth first we'll assign sessions to one session host until the maximum number of
connections is met in this case two and then starts with the next next I'm gonna
log in a couple more times so we can see the -1 session host fill-up now I'm
logged into four let's take a look at that command again okay so as you'd
expect it directed the next two sessions to -1 session host but what happens
if we try a fifth now that we have max connection set to two each and there's
only two so that's four total connections I'm gonna just try to log in
to the fifth okay so that threw an error I can try reconnecting just to make sure
but I think we're gonna see that error again yep it just gave me the error
again so once the maximum number of connections
for the host pool is met nobody can login which is exactly what I guess
you'd expect with setting the masks sessions okay so we went over the
default settings of breadth-first we saw that work we disabled new sessions on
one of the two session hosts and saw how that behaves with breadth-first we
switched to depth-first and saw how that distributes connections and then we
tried to go over the maximum number and saw that that failed the only thing left
to do is I want to change this back to breadth-first so if I come here you can
run this command this is the set RDS host pool command and we're changing it
to breadth-first load balancer you can see that did it but there is a problem
still it's set to breadth-first but you can see that the max session limit is
two so you don't need to specify a max session limit with breadth-first but it
will just keep that old setting so I'm going to set the max connections to 999
thousand
now it's set let's run the get RDS host pool command again and here you can see
it's set to breadth-first with 999 thousand so that puts it back the way it
was when we started that does it for the demo that's it for the video you can
find the command I used on my blog link below I hope you found this helpful
please take a second to subscribe and click the bell icon for new content
thanks for watching