when deploying our applications and vm's into the cloud one thing that we do have
to keep in mind is how sensitive they'll be to network latency now network
latency is the delay that happens when two things are trying to communicate
over a network and we're limited of course by the speed of light at least
for now but as we continue to grow and expand into the cloud the cloud itself
is also growing at a humongous rate so where you place your resources is going
to start to have more of an impact now to reduce Network latency and keep
performance as high as possible we've got several choices and we'll
certainly dig into some of that today but none of them is going to get as low
at latency as the subject of today's video and that's proximity placement
groups
I'm Dean cipolla and this is the Azure Academy proximity placement group is a
logical construct that we set up in Azure that is going to link our VMs as
close as possible together now in a previous video we talked about Azure
dedicated hosts and how that was a VM that you would have in your subscription
dedicated to you and you could spin up multiple VMs on that host and if you
miss that video you can check it out in the YouTube card at the top where
proximity placement groups differ is that you will be able to expand beyond
just a single VM family or SKU type you could actually combine multiple
different kinds of SKUs together and put them in close proximity within this
placement group so let's start off in our Docs because there's a few things we
have to go through to have this all make sense
so for proximity placement groups we're gonna go to products and then in here we
can go to Windows or Linux virtual machines and then over on the left we
want to go to concepts availability and performance and go to colocation so in
the dock here you can scroll down and see a graphical example of what a
placement group is going to do and this is where we could take different types
of systems or availability sets skill sets and we can put them all within a
group that's going to put them as close as possible together so that we get as
low a latency as possible so this does bring up some limitations for example
availability zones so when looking at availability in Azure starting off on
the right side we have our different Azure regions that have hundreds of
miles in between them and inside those regions there are data centers depending
on how many data centers there are and where they are located there may also be
availability zones so we see here region two on the bottom as just data centers
in it no availability zones but the top one region one does have data centers in
availability zones so zooming in on that here's our region and this one has three
availability zones now availability zones themselves are not necessarily
limited to two datacenters per zone there could be
two there could be several more it just depends on the size of that region then
inside that regions availability zones we have the data centers themselves
within those data centers they all have their own independent power cooling
generators backup and equipment like hosts and storage and then within there
is where we provision the VMS so a proximity placement group is going to be
dealing with the hosts where they're located in the racks in the data center
within the availability zone within the region so you cannot have a proximity
placement group spanning multiple regions or multiple availability zones
they would be just too far apart to have that same low dedicated latency that we
can get within a single data center so now considering the blast radius of this
diagram you'd have to then concern yourself with
high availability and disaster recovery of your applications but that's a little
out of the scope of this immediate video if you're interested in looking more
into that we do have a whole series on disaster recovery and migrations so you
can go check that out in the YouTube card so some of the other things around
the network latency reduction that we're trying to gain by using Plex emiti
placement groups means that we need to turn on accelerated networking now for
accelerated networking let's go back to the main page of the azure Docs and
we'll go to products we'll scroll down for networking and then go to our
virtual networks and under the how-to guide section over here on the left
we'll go under deploy then under virtual machines and
create VM with accelerated networking and we'll click on this first link and
this is using a technology that's called single rutile virtualization or SR IO V
and this is a technology whereby we let the network card do some of the heavy
lifting for us now it's a little hard to see here in this graphic
so let's animate it so over on the left side we have our traditional networking
without SR IO V and this is where the network traffic goes from the VM to the
VMS network card then it's going to hit the virtual switch inside the VM host
then passing to the physical network card to the physical switch now this is
certainly fine for almost all of your processes but considering latency we
want as fast a throughput as we can so over on the right side we have
accelerated networking so the traffic goes from the BM to the NIC and then
it's going to bypass the virtual switch inside the host directly to the physical
NIC where the processing of that network request is going to be done to the
physical switch so the processing happens much faster because we're
bypassing a whole hop in the process as well as we're offloading that from the
CPU of the host to the network card processor itself so not every VM sku and
azure supports accelerated networking this requires this technology baked into
the network card which is dependent on which host family you're using so over
on the limits and constraints link on the right you can see which VMs queues
are supported right here now there are ways that you can use PowerShell to
enable this on existing workloads or use it to create workloads that's all in the
docs here we're gonna walk through this in the azure portal so at the top of the
portal first thing we're gonna do is hit us to create a new resource and we can
click this link to deploy a Windows Server and we'll create a new resource
group for this and we'll just call that procs group and hit OK
and we'll call this procs VM one and put it in the east us region and then we'll
build this on a 2019 VM image and scrolling down we've got our VM size so
here we're gonna hit change now if you've watched our videos before you
know I favor the b2m s size however when we go to the networking screen here
we're going to see that accelerated networking it does not work on this
particular SKU we're gonna have to go with something else so for today per our
documentation we'll be going with a d4s v3 so we'll hit select for that and then
hit next for our disks and I'm fine with a
premium SSD on this VM we'll hit next so we will need a network for this and
I'll leave these settings as is and then as we scroll down we see accelerated
networking has been enabled and then if you mouse over the tooltip here
not only tells you what it is but you get a quick link get over to the
accelerated networking Doc's that we were just looking at and clicking ahead
to the advanced screen now we have to make a choice we can at this point
choose to use a dedicated host and select that and select our particular
host that matches our VM family however if we do proximity placement group will
not be able to be selected and that's because this basically does the same
feature the difference being that proximity placement groups do not have
to all belong to the same VM family we can mix and match sizes and skews where
as host groups you have to use the same VM family as you are building your
systems so if you have ad series hosts you cannot have an M series VM whereas a
proximity placement group you can mix and match these things all you want as
long as they're in the same region or same availability zone however you're
building those out now I'm not actually gonna select this here as we'll do that
after the fact but I wanted you to just see that so moving on to our tags and
I've added my cost center tag here and we'll hit the review and create button
everything looks good here so let's create
so vm1 has finished building and then under networking in the blade we can see
that accelerated networking is enabled go back in our resource group I've also
provisioned a second virtual machine in the background but I also wanted to walk
you through creating a BM scale set so we'll hit add for this and we'll search
for a virtual machine scale set and click that and then click create I'll
call this procs VMs s1 and then we'll put it in the east US and I'm not going
to currently select an availability zone under the orchestration section we're
going to leave it on virtual machines scale sets and then select our
appropriate image which will be 2019 data center and then we'll select our BM
size so we'll add a few filters here just to make it a little easier to find
the appropriate BM so we'll click add filter and then you select any one of
these particular data points and I'll select generation and then I'll make
sure that it's on current because I want only the latest virtual machine hardware
and I'll add one more filter here and this will be for the V CPUs and I'll
just limit this to four and then I want to sort this by cost so I can find the
right resource and I'll pick the f-4s v2 for this and we'll hit select and then
add the rest of our information and we'll also turn on the azure hybrid use
benefit and we did a prior video on ways to save money and Azure up here on the
top right if you're interested in that it looks like next and for this one
we'll select standard SSDs and hit next for networking and we'll have this go to
the same virtual network that we just created and then as you can see in the
network interface section accelerated networking is currently turned off and
we can change this by clicking the edit button so here's where we'll create the
network cards name and you can change that if you would like what subnet will
be deploying these systems to and whether or not we'll have a network
security group enabled which I'm going to turn off at this point and here's
where we just turn on accelerated networking so we'll skip ahead here to
the tags and I'll add my cost code tag and then hit the review and create
button and everything looks good so let's build it now while that's
deploying it let's build a placement group so at the top and the
search bar will type Proximity and there's our proximity placement group
service will click on that and then click the button here to create one so we'll
put our placement group into our proxy resource group and we'll put that in the
east us where our resources are and then we need to give it a name and we'll hit
next and then put our tags and we've added a tag for our cost center our
application of the Azure Academy this is a lab environment for the IT business
unit with a maintenance window of Thursday at 6 p.m. we'll hit review and
create there and then hit the create button
and here's where we stand we've got our two virtual machines created as well as
our VM ScaleSet and our proximity placement group now the VM ScaleSet
just like a virtual machine under networking and the blade is where you
can see that accelerated networking is enabled now the proximity placement
group itself well there's not a whole lot to it it's just a logical container
that we need to put stuff into but we can't do that from here we've got to do
it from the virtual machines now the VMS themselves under configuration in the
blade is where he could make this change just like where you can add host groups
you need to have the VM in ad allocated State in order to change this on
existing VMs so let's power these guys down we'll go to all of our virtual
machines and we'll select our proximity guys and turn them off and while that's
going let's go to our virtual machine scale set and we have to deallocate this
one as well so now that the D allocation is complete we can assign these to our
proximity placement group inside the VM we'll go to configuration and there is
the proximity placement group selector and we'll just pick our group and hit
save and now if we go back to our resource group and we get our VM skill
set under configuration we can load our proximity placement group here as well
and now that we've added our systems to our proximity placement group when we go
back in there we can see that there they are registered with our group so you can
look at this as two database servers sitting here inside a proximity
placement group with a VM scale set front-end as a whole application all
tightly coupled together or lower latency and better performance so let's
see some of this in action so there's a few different ways that we can test
latency that's actually covered in our Doc's so we'll go to products we'll
scroll down to networking then virtual networks and on the left under the
how-to guides we'll go to configure and under there we'll go to optimize network
throughput now in case you're using a VM skew that cannot use accelerated
networking it doesn't mean you're completely out in the cold
there's a way to do something similar using reverse side scaling and
there is a easy PowerShell command that you can use here to turn that on so I've
got the PowerShell terminal inside a visual studio code opened and I know I
said in the past that I haven't been using VSCode and I'm just actually
getting into it so any tips or anything that you could give me I'd appreciate it
if you could put those in the comments field as I start learning this tool and
I'm doing this because there's going to be some cool things coming to the azure
resource manager and templates and blueprints so if you're interested in
that stuff click the subscribe button so you don't miss our upcoming video on
that but I've got the PowerShell terminal opened here and I'll just run a
quick command of get - net adapter RSS and hit enter and as long as you see
that enabled is true here then you should be good to go and this is
generally on by default on Windows and it the same equivalent feature is on by
default on all modern Linux distros and you can see more of that in the docs
here in case you can't use accelerated networking and have to rely on RSS but
in the table of contents here if we come out of configure and go to troubleshoot
and we scroll down a little bit there is a link here to test VM network latency
and this docket goes through a bunch of different things explaining latency how
it works how to test for it and specifically there is a link here to
download Latte for Windows or SocPerf for Linux to do actual latency tests ping
which is a very commonly used network tool tests for connectivity but it
doesn't actually test latency at all and that's called out here in the docs you
know ICMP is just something that doesn't do this and if you scroll down a little
further then you can see the tests that we're going to run and so there is first
here a firewall rule to allow Latte through your firewall and then there is
some stuff here or running an actual test and we're gonna do this from my
local machine here over my VPN to Azure so this is one of my virtual machines up
in Azure and I've already downloaded latte to this machine and this is a
client server test so we'll set up this VM in Azure as our server and we'll do
that by calling latte with - a which is the IP of our server and there
our local IP address and a port by default this is going to do ten thousand
iterations on this test but I'll kick this off on the server side and this
lets us know that it's ready and then back on my client in VSCode I'll run a
latte here and the - c flag lets us know that this is the client talking to
our server on the same port and this is our latency in microseconds which is not
great admittedly but this is over my VPN so let's see what this is like from a VM
to another in Azure on the Left we've got our server restarted and we've got
another VM in Azure or I'll kick off the client and this again will do 10,000
iterations and that only took about a second or two and you can see the
latency here from VM to VM in Azure this is definitely much better than what we
had over our VPN I've got our proximity VMs set up here so on the left we've
still got our latte server and on the right we've got both of our hosts with
accelerated networking enabled so we'll do one test first from accelerated
networking here with our VM-1 over back to our server that does not have it
enabled and just with one side of the equation setup we've got four hundred
microseconds latency so a big improvement even over a sure to Azure
VMs let's try this again now we'll go with VM one running latte as a server
and so for this test we need to find the IP of our local system which we can find
with IP config and there is our IP address so now for latte we use that for
our server IP and we'll start that up and then over here on VM-2 we'll run the
latte command and we'll have it talk back to VM one and you can see that that
took seventy-three point five five microseconds it is certainly the lowest
latency connection that you could get in the cloud so hope that you've enjoyed
looking at proximity placement groups and accelerated networking ways that we
can position your VMs in the cloud to reduce your network latency and give you
the highest amount of performance possible between different VMs so if you
thought that this video was good please give us a thumbs up and while you're
down there click on the subscribe if you haven't already and join us here
at the Azure Academy and contribute down below to the discussion that goes on if
you have any questions or suggestions on any videos that you'd like us to do in
the future we're certainly looking for your
feedback and how we can improve helping you all to learn more about Azure and if
you'd like to get an email notification when our videos come out which is
roughly once a week you can click on that email bell down there as well
thanks very much for joining us today and we will see you in the next video
happy learning