Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Container Fundamentals | Part 4 - Resource Management

0 (0 Likes / 0 Dislikes)
  • Embed Video

  • Embed normal player Copy to Clipboard
  • Embed a smaller player Copy to Clipboard
  • Advanced Embedding Options
  • Embed Video With Transcription

  • Embed with transcription beside video Copy to Clipboard
  • Embed with transcription below video Copy to Clipboard
  • Embed transcript

  • Embed transcript in:
    Copy to Clipboard
  • Invite a user to Dotsub
[The Containers Channel] [Container Fundamentals Resource Management] [The Containers Channel Microsoft] >> Hello, and welcome to another episode [The Containers Channel] Microsoft Matt McSpirit Technical Evangelist] on The Containers Channel. [The Containers Channel] Microsoft Matt McSpirit Technical Evangelist] I'm Matt McSpirit, technical evangelist for all of our Datacenter stuff. [The Containers Channel Neil Peterson Senior Content Developer] And I'm joined again by Neil Peterson, [The Containers Channel Neil Peterson Senior Content Developer] content developer working on our container stuff. [The Containers Channel Microsoft] And in this episode again, [The Containers Channel Microsoft] another key part of our Containers Fundamentals series, [The Containers Channel Microsoft] in the previous part, we looked at shared folders, [The Containers Channel Microsoft] so hopefully you found that useful if you've seen it. [The Containers Channel Microsoft] Loads of cool stuff there about how containers are used, [The Containers Channel Microsoft] shared folders for their data and their resources. [The Containers Channel Microsoft] In this particular episode, [Containers Fundamentals Resource Management] we're gonna be looking at resource management. [Containers Fundamentals Resource Management] How you start to control the CPU, the memory, the storage usage of a container. [Containers Fundamentals Resource Management] So, Neil, explain to us what resource management [The Containers Channel Microsoft] is it in a more depth and help us understand what we can do around a container [The Containers Channel Microsoft] in terms of resource management. [The Containers Channel Microsoft] >> Sure. [The Containers Channel Microsoft] So it's pretty simple with TP4, [Resource Management PowerShell: Docker:] we released several capabilities [Resource Management PowerShell: Docker:] around managing the container host resources. [Resource Management PowerShell: Docker:] >> Yes. This technical preview for Windows Server 2016. [Resource Management PowerShell: Docker:] >> Yep. >> Wasn't in TP3. [Resource Management PowerShell: Docker:] >> Exactly. >> Okay. [Resource Management PowerShell: Docker:] >> And so what we're talking about here is making sure that, you know, [Resource Management PowerShell: Docker:] our containers are working as good citizens [Resource Management PowerShell: Docker:] with other containers on the host. [Resource Management PowerShell: Docker:] Very similar to what we do with virtual machines. [Resource Management PowerShell: Docker:] So I may have a container that I want to start up [Resource Management PowerShell: Docker:] and, you know, make sure that it's only using [Resource Management PowerShell: Docker:] 10 percent of the CPU and constrain its memory [Resource Management PowerShell: Docker:] and constrain the outgoing network traffic, and constrain the IOPS of the storage. [Resource Management PowerShell: Docker:] And so these are the things that have been added in TP4 that can control. [Resource Management PowerShell: Docker:] >> So that's very important [Resource Management PowerShell: Docker: The Containers Channel Microsoft] especially if you were for instance a service provider [The Containers Channel] and you had, you only have so much capacity [The Containers Channel] or the finite amount of CPU memory, disk and so on. [The Containers Channel] And if you've got a container that perhaps is [The Containers Channel] compromised with malware or it's something that [The Containers Channel] process just starts to leak and starts to go out of control, [The Containers Channel] it could eat all your resources and affect A, the other containers, and B, [The Containers Channel] all the tenants that are paying you money as well, so having these kind of controls is important. [Resource Management PowerShell: Docker: The Containers Channel Microsoft] >> Yeah, absolutely. >> Okay. [Resource Management PowerShell: Docker: The Containers Channel Microsoft] And how do we... So it's controllable through PowerShell and Docker? [Resource Management PowerShell: Docker: The Containers Channel Microsoft] >> So it's still early days, I mean we're still in technical preview, [The Containers Channel] so this is going to be evolving, more capabilities will be added, [The Containers Channel] but currently we've got four capabilities with PowerShell. [The Containers Channel] So that's CPU, memory, networking, disk. [The Containers Channel] And then some minor capabilities with Docker around CPU relative weight. [The Containers Channel] >> Right but at least today that's, [Resource Management PowerShell: Docker: The Containers Channel Microsoft] is still in preview, we're still evolving, [Resource Management PowerShell: Docker: The Containers Channel Microsoft] and we're always building with Docker as well, so even though you think, [Resource Management PowerShell: Docker: The Containers Channel Microsoft] oh, the list is a little bit longer for PowerShell, [Resource Management PowerShell: Docker: The Containers Channel Microsoft] that's not to say that that will reflect the final release [Resource Management PowerShell: Docker: The Containers Channel Microsoft] 'cause we're still a little bit away, so. [Resource Management PowerShell: Docker: The Containers Channel Microsoft] >> Yep. >> Are you gonna show us all of these? [Resource Management PowerShell: Docker: The Containers Channel Microsoft] >> Yeah, so why don't we just jump right in and just take a look. [The Containers Channel Microsoft] >> Great. [The Containers Channel Microsoft] >> So what I'm gonna do is, I'll actually get pretty granular with CPU. >> Yeah. >> So we'll set it, we'll see a couple of things and I'll actually show a container consuming all the CPU of the host and then we'll constrain it and see how that affects that container and then we'll just look at the other commands and just see what's there. >> That sounds good. >> Right, so I'm gonna start, let me just make sure that this is ready. Right, so I'm gonna start just by creating container... Nothing too special going on here, so I'm creating a new container named resource, using the Windows Server Core image. I'm also adding a container shared folder, so we talked about this in a previous video. >> Yeah. >> What I'm doing here is just presenting a script to the container that I'm actually gonna run that's gonna peg the CPU. >> Right. That script is contained within the directory that you're sharing to the container. >> Yep. >> Absolutely. >> So if we look at this command, Get-ContainerProcessor, so I'll go ahead and run that right now. We can see that we've got... We actually have two metrics here that we can control. So per centum the CPU a container can consume and then the relative weight. We really is gonna focus on the percent of the CPU that we can consume here. >> Right. >> And we can see here that it's set at 100 percent by default. >> Yeah. >> I can use Set-ContainerProcessor command to manage that, so I'll go ahead and set it to 50 percent. Let me just stop this. >> Here we go. >> Alright, then I'll run Get-ContainerProcessor again and we can see that it's changed to 50 percent so pretty simple. >> And you can imagine I suppose even though we're not doing it now, relative weight will be something we can modify later on. I mean if you're not familiar, maximum it's more of an explicit, you can't go above 50 percent or its relative weight is in reflection of not only this container perhaps all the containers... >> Every container running on a host, yeah. >> Okay, so let's very similar to what we see in virtual machines as well, certainly within on a Hyper-V platform where you can start to control within systems that you've got some of those more granular controls. >> Yep. And all these commands are documented on our documentation page circle. Alright, so let's actually just, I mean just to see it in action let's just go ahead and take a look. I'm gonna set that back to 100. So this is just as if we just created it. I'm gonna go ahead and start the container. >> This is starting your container that we call resource. >> Yep. And so I'm also [CPU] going to create a PowerShell session with that container. [CPU] >> Okay. [CPU] >> So at this stage, you've not done anything to peg the CPU at this stage. [CPU] You just set it as maximum 100 so it's essentially, is default a 100? [CPU] >> Yes, default 100. >> Okay. [CPU] So it's back to default. [CPU] You've got a free reign essentially on what you can use inside this container [CPU] and now you're gonna execute the script that you talked about earlier. [CPU] >> Yep. Exactly. [CPU] >> And that's being pulled from the shared folder. [CPU] Those of you who watched the previous video, you'll know, you'll recognize test 2, [CPU] the docs that Neil created during that demo. [CPU] >> Yep. [CPU] So we can here now, now just to be clear, we're looking at the container host. [CPU] >> Yeah. [CPU] >> So we're looking at the performance of the container [CPU] host here from within the container. [CPU] I'm gonna go ahead and run the script. [CPU] And we can see immediately that we've basically pegged the host. [CPU] >> So this would impact every other container that's on this particular host? [CPU] >> Yep. [CPU] >> So it's not constrained to that container itself? [CPU] >> Yep. Absolutely. [CPU] And in fact, we can go over here to details. >> I can hear your laptop getting hot so. >> Yeah, my laptop is getting hot and... >> And subsequently hot. >> And so since it's a PowerShell process that I'm running inside of the container, we can actually see it on the host because this is a Windows Server Container and so there it is right there, PowerShell.exe. Yeah, we can see that it's going crazy. >> Okay. [Task Manager, End process] >> So I'll go ahead and stop that process which coincidentally kicked me out of the container. So what I'm gonna do now is go back in. I'm gonna stop that container. And now we will throttle down what that particular container can use. >> So is the change only possible to made with a stopped container, you couldn't do it on the fly? >> At this time, yeah. >> Right. Okay. >> So I'll go ahead and modify that, so I've got Set-ContainerProcess, the container name, maximum 20, so I'm gonna go with 20 percent. >> If you think about service though, the power that's in today's modern datacenter service, 20 percent of a CPU still or 20 percent of the CPU capacity is still a decent amount of CPU. >> Yeah, absolutely. >> Yeah. >> Absolutely. And I'll go ahead and start the container up. And now we'll just go ahead and do the exact same thing. So I'll create a session with the container. [CPU] >> So now you're gonna run that same script again. It's really harming the CPU. [CPU] >> Yep. [CPU] >> So we can see on the right, it was about 50 or 40 percent. [CPU] >> Yes, so we were leveled off about right and so here is as low as got right here. [CPU] And you can see now our baseline is increased a little bit. [CPU] >> Yeah. >> But we're not pegging it. [CPU] >> No. [CPU] >> Where as we're running the exact same script, [CPU] so we've effectively throttled this down quite a bit. [CPU] >> Yeah, it is fluctuating, you might see it fluctuate slightly above, [CPU] slightly below and so on as it goes. [CPU] For the most part it's managed to keep that pretty... >> Yeah, and again we can come in here and we can, you know, we can see the effect that we've had on the container. >> Yeah, just through that simple setting. >> Yep. So that's CPU. Now I'm not gonna go through the same demonstration for the rest of them but we will take a look at the commands. So let's take a look at our memory, so... We've got this command Get-ContainerMemory. We can run that for any container. I'm gonna go ahead and actually stop this container real quick. So if I run Get-ContainerMemory... I'll just clean up a little bit. We can see that my maximum memory is at this very large value right here. >> Yes. >> So I've done a little bit of PowerShell to make that look a little easier to read, so what we have by default is a 1024 gigabytes of memory for a container. >> Gigabytes, not megabytes? >> Gigabytes, not megabytes. >> Right. Okay. It's quite generous. >> Yep, that is quite generous, so what we can do is run Set-ContainerMemory, the container name in maximum bytes. >> Yeah. >> So I'll do 1024. If we run the same thing so we can now see that we've essentially... Yeah, we got a gig or if we wanted to do something like 512. >> Yeah. >> 0.5. >> Nice. >> It's pretty simple. >> Yeah. >> Storage, we've got a command Get-ContainerStorage, so I'll go ahead and run that. And we can that we've got maximum bandwidth and maximum IOPS, so this is bytes per second or normalized IOPS. >> Right. >> And again, Set-ContainerStorage, give it a value. And we can see that one has been set and we can set the maximum IOPS. >> Nice. >> So networking, we've got Set-ContainerNetworkAdapter. Still some work being done on this command. >> Yeah, I'm guessing that would be Get as well for that. >> Yeah, there's a Get network, container network adapter but it doesn't show the results at this point. >> Okay, still work in progress. >> Yep. So that's, you know, pretty simple stuff, straightforward, straightforward PowerShell stuff. [The Containers Channel Microsoft] But we've also got some minor capabilities with Windows Containers and Docker. [The Containers Channel Microsoft] >> Right. [The Containers Channel Microsoft] >> So the command is [CPU-shares] CPU-shares and this is very similar to relative weight. [CPU-shares] >> Yeah. Okay. [CPU-shares] >> And I won't demonstrate that. >> Okay. Great. [CPU-shares] So these are applicable, these commands to Windows Server containers, [CPU-shares] Hyper-V containers as well? [CPU-shares] >> Still some work being done in that area. [The Containers Channel Microsoft] >> Right, okay, so tuned for that one, but at least you can start to play around [The Containers Channel Microsoft] where they get used to from the Windows Server perspective [The Containers Channel Microsoft] and start to understand how they work, [The Containers Channel Microsoft] so I don't think not that many people probably [The Containers Channel Microsoft] know resource controls are in there. [The Containers Channel Microsoft] So once you start to read the documentation, [Resources Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] they're very, very important to understand [Resources Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] for that very scenario like Neil demonstrated [Resources Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] where you've got a wild process or service [Resources Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] or application that is consuming so much [Resources Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] resource whether it be across disk, CPU, [Resources Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] memory or network. [Resources Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] Well, is that network on both ways traffic or is it just into the? [The Containers Channel Microsoft] >> Out. >> Just out from the container? [The Containers Channel Microsoft] >> Yep. >> Okay. [The Containers Channel Microsoft] Sounds good. So... [The Containers Channel Microsoft] >> Yeah, and there is still being work being done here [The Containers Channel] and our documentation will stay up-to-date as this work progresses. [The Containers Channel] >> Okay. [The Containers Channel] So we always link to the documentation on the page as well, [The Containers Channel Microsoft] so you can always get the latest information on it, [The Containers Channel Microsoft] it's on the slides, so you can see it on the video. [The Containers Channel Microsoft] But recommended things many to do, download the technical preview, [The Containers Channel Microsoft] start to play with it, play with the resource controls [The Containers Channel Microsoft] that Neil has just demonstrated [The Containers Channel Microsoft] and the shared folders we talked about in the previous video. [The Containers Channel Microsoft] Check out the documentation. [The Containers Channel Microsoft] It tells you how to walk through a lot of these things. [The Containers Channel Microsoft] You'll see a lot of these videos actually embedded with some of this content as well, [The Containers Channel Microsoft] so definitely check it all out. [The Containers Channel Microsoft] You can view the Microsoft in Docker, relevant documentation as well on Docker site, [The Containers Channel Microsoft] there's loads of useful information to get you started there [The Containers Channel Microsoft] and you can try it on your own environment or there's the capabilities [The Containers Channel Microsoft] to try it in Azure as well, so loads of different ways [The Containers Channel Microsoft] you can get started very, very quickly. [The Containers Channel Microsoft] But that brings us to the end. [The Containers Channel Microsoft] In the next episode we're gonna be taking a look at [The Containers Channel Microsoft] Hyper-V containers, so make sure you check out [The Containers Channel Microsoft] that one because it's really important to understand [The Containers Channel Microsoft] how Hyper-V containers differ, what they look like, how they manage, [The Containers Channel Microsoft] is it radically different, is it very simple, is it very straightforward, [The Containers Channel Microsoft] we'll cover all of that stuff. [The Containers Channel Microsoft] So make sure you check that out and all that's left is for me to thank Neil. [The Containers Channel Microsoft] Thanks for your time again as always. [The Containers Channel Microsoft] And yeah, we'll see you again on another episode of The Container Channel. [The Containers Channel Microsoft] Thanks. [Resources Download Windows Server 2016 Technical preview Read the Containers documentation Microsoft and Docker Partnership Get started with Docker] [The Container Channel] [9 channel9.msdn.com]

Video Details

Duration: 13 minutes and 51 seconds
Country: United States
Language: English
License: All rights reserved
Genre: None
Views: 35
Posted by: duncanma on Feb 19, 2016

----- (Please provide translations for these languages: Chinese (Simplified) (chi_hans), Chinese (Traditional) (chi_hant), English (eng), French (France) (fre_fr), German (ger), Italian (ita), Japanese (jpn), Korean (kor), Portuguese (Brazil) (por_br), Russian (rus), Spanish (spa).)

Caption and Translate

    Sign In/Register for Dotsub to translate this video.