Sunday, July 28, 2013

Jumbo Frame MTU on vSphere Software iSCSI Adapters

In the book "Storage Implementation in vSphere 5.0" (SIIV5) from VMware Press, I ran across a really cool piece of information. It is regarding the MTU on port groups bound to Software iSCSI Adapters in vSphere environments. It has been a discussion I have had with a handful of people previously but in a slightly different sense. Previously when discussing this topic it was a conversation which focused on setting Jumbo frames (when using iSCSI software adapter) for a 1Gb network or leaving it at the standard 1500 MTU. I have generally heard that it does not improve network performance to use Jumbo Frames on a 1Gb connection, and if it does improve performance it is negligible and not worth it. What I found while reading SIIV5 is that myself and those whom I have had this conversation with before were possibly attributing the performance gain to the wrong portion of the environment. Where we were looking for networking performance improvements, SIIV5 actually pin points the performance gains on the ESXi host CPU level. As a review for some people and maybe new information for others here are a couple bullet points to quickly summarize the different categories of iSCSI initiators you can use with ESXi, this information is key in our discussion:
  1. Independent Hardware Initiator -  This initiator functions and operates on its own outside of any need to interface with ESXi. They offload all iSCSI and network processing from the host and onto the controller. They can be managed  through their firmware and in some cases through the vSphere UI.
  2. Dependent Hardware Initiator -  This initiator also can offload iSCSI and network processing from the host onto the controller, but dependent initiators depend on the ESXi host for  the network stack, configuration of the initiator and management through the commandline or the vSphere UI. Because it does has dependencies on the host, its offload capabilities are not an assumed function but is made possible through the use of TCP Offload Engine to move the processing of iSCSI and networking to the controller. Wiki Article about TOE. Requires that a vmkernel port group be created and bound to vmnic.
  3. Software Initiator - ESXi provides the software initiator as a component of the vmkernel. It requires ESXi to operate and can only be configured from either the commandline or the vSphere UI. Requires that a vmkernel port group be created and bound to vmnic.
It goes without saying that because the Software iSCSI adapter has no dedicated hardware, unlike an Independent or Dependent iSCSI adapter, they lack the off loading capabilities of non-software iSCSI adapters. This can potentially put more stress on the ESXi host's CPU as it has the need to handle every datagram, fragment payloads, and recompile payloads. Because of no dedicated hardware controller backing, VMware in SIIV5 recommends to always set the MTU on Software iSCSI port groups to 9000 (Jumbo Frames), this will improve performance by minimizing the load on the ESXi hosts. This improvement manifests itself as the CPU will no longer need to process so many datagrams as it begins working with larger network payloads. As stated in SIIV5:
"To compensate for lack of offloading capabilities of the iSCSI SW initiator, enabling Jumbo Frame can significantly I/O throughput." SIIV5 pg.140, "Configuring SW Initiator with Jumbo Frames"
The question about using Jumbo Frames for 1Gb networking of not no longer exists in my mind. When using a Software iSCSI Initiator in vSphere, Jumbo Frames is always the WAY-TO-GO! Now although I do not profess to be a storage or networking Guru, I hoped to pass on this information so that others who may be wondering about these topics have a good place to start learning!



Tuesday, October 23, 2012

PowerCLI: ESXi Host Audit

I try to keep up with the VMware communities/message boards for PowerCLI related questions and saw one that I thought was interesting. Someone was interested in creating a script that could preform an audit of their ESXi hosts in inventory. He wanted the script to include the following:
  • Product Name
  • Version
  • Edition
  • Host Name
  • Number of Cores
  • Number of Physical Processors
So Mr. Buzzlightyear... if that is your real name, here it is, I know I am little late, but I think my script is a little easier to understand and use. In reality I turned the script actually into a function called: Get-VMHostAudit. Run this script, or add it to your PowershellCli profile and off you are to the races.

The script:


function Get-VMHostAudit
{
param([parameter(mandatory=$true)][string]$vCenter,
        [parameter(mandatory=$true)][string]$Username,
        [parameter(mandatory=$true)][string]$Password,
        [parameter(mandatory=$true)][ValidateSet("List","Table")]$Format)

Connect-VIServer -Server $vCenter -User $Username -Password $Password
$ServiceInstance = Get-View ServiceInstance
$LicenseManager = Get-View $ServiceInstance.Content.LicenseManager
$LicenseManagerAssign = Get-View $LicenseManager.LicenseAssignmentManager
$VMhosts=Get-VMHost
$VMhostsTotal=@()
Foreach($VMhost in $VMHosts)
    {
    $VMHostView=Get-VMHost -Name $VMHost.name | Get-View
    $VMhostID=$VMHostView.Config.Host.Value
    $VMHostLM=$LicenseManagerAssign.QueryAssignedLicenses($VMhostID) 
    $VMhostsTotal+=$VMHostView | Select Name,
        @{n='Product';e={$_.Config.Product.Name}},
        @{n='Version';e={$_.Config.Product.Version}},
        @{n='Sockets';e={$_.Hardware.CpuInfo.NumCpuPackages}},    
        @{n='CPUCores';e={$_.Hardware.CpuInfo.NumCpuCores}},
        @{n='LicenseVersion';e={$VMHostLM.AssignedLicense.Name | Select -Unique}},
        @{n='LicenseKey';e={$VMHostLM.AssignedLicense.LicenseKey | Select -Unique}}
    }
If ($Format -eq "List"){$VMhostsTotal | Fl}
If ($Format -eq "Table"){$VMhostsTotal | Ft -AutoSize}
Disconnect-VIServer -Server $vCenter -Confirm:$False -Force
} # End Function

How to run it:


Just run the script to load the function into your shell and then execute the function. Heres an example:

C:\Scripts\PowerCLI\VMHostAudit.ps1

Get-VMHostAudit -vCenter 192.168.0.1 -Username ITMonsterrrrrr -Password Cr@CkTh!s -Format Table

As I mentioned earlier, add the function to your profile also, then you will always have it when you want to run it. Here is my favorite resource for Powershell profiles. Here is an example of the output, you can choose from either listed form or table form, just hit tab after the format switch to cycle through your options.


Name           : 192.168.25.41
Product        : VMware ESXi
Version        : 5.0.0
Sockets        : 1
CPUCores       : 4
LicenseVersion : VMware vSphere 5 Enterprise Plus
LicenseKey     : 00000-00000-00000-00000-00000

Name           : 192.168.25.42
Product        : VMware ESXi
Version        : 5.0.0
Sockets        : 1
CPUCores       : 4
LicenseVersion : VMware vSphere 5 Enterprise Plus
LicenseKey     : 00000-00000-00000-00000-00000



Name          Product     Version Sockets CPUCores LicenseVersion                   LicenseKey                   
----          -------     ------- ------- -------- --------------                   ----------                   
192.168.25.41 VMware ESXi 5.0.0         1        4 VMware vSphere 5 Enterprise Plus 00000-00000-00000-00000-00000
192.168.25.42 VMware ESXi 5.0.0         1        4 VMware vSphere 5 Enterprise Plus 00000-00000-00000-00000-00000

How it works:


After reading the passed parameters of $vCenter, $Username, $Password and $Format, the script connects to vCenter. We grab a view of the vCenter instance its self, we then request a license manager view for the vCenter instance. After we have stored the license manager assignment view for the instance in the $LicenseManagerAssign variable we then grab all of the ESXi hosts for the instance in the $VMHost variable. Then we begin to cycle to through each host and do the following: We grab a view of the host, and assign its host ID to the $VMHostID variable which will be used in a second. We then query the License Manager for the assigned licenses for the ESXi host matching that $VMHostID. With that information stored in the $VMHostLM (licenses manager) variable, we then just compile all of the desired data. We pick up host name, product name, version, cpu cores, and sockets from the $VMhostView variable and add in the license and key by using calculated expressions to query the $VMHostLM variable. We actually add this data to the $VMHostsTotal array, which by doing this will allow all of the hosts to put their data into that array and presented at one time, instead of having a table for each host, we essentially create 1 table by adding each hosts data to that array. After it determines if you defined a list or table to be used, it spews the data and disconnects from vCenter! Thats all she wrote! You could easily add in functionality to export to a CSV or HTML, although with this information I dont see an HTML output being very handy, but I do see a lot of value for using CSV to archive this information. If you need help editing the code to add more functionality, just let me know!

Syntax View:



























I use Powershell and Powershell ISE 3.0.

Sunday, October 7, 2012

VCP5: Memory Reservations

Understanding entitlements ,and in this case memory reservations, is a key concept to pass the VCP5 exam, although this concept is easily grasped by most people, the exam presents questions regarding these subjects in ways that will have you thinking hard. Remember entitlements are not only configured in one location. Knowing these locations and the optional settings you could configure is need-to-know information. As some starting points, know what memory reservations, limits, and shares are and HOW THEY ARE DIFFERENT. Also, know where you can set memory entitlements. Below are a few screen shots to show you where you can set them:

All entitlements including disk and cpu can be set by right clicking any VM and navigating to the "Resources" tab:


















Take note of the check box in the top right corner, "Reserve all guest memory (All locked)". This can be a super helpful component if you have a VM that is key to day to day operations and should always be guaranteed all of its memory, this is where you would configure that setting. Essentially, selecting this option removes the amount of RAM assigned to the VM from the pool of resources available to all other VMs, just as other reservations do for a specified amount of memory.

This next screenshot is the "Resources" page when you select to edit the settings of a vApp. If you dont know much about vApps I suggest you go here and read up on them in the vSphere Documentation Center, but basically a vApp is a container for housing VMs that are components of maybe a single application, like for instance, a web server, a database and an application server could be in a vApp for ease of management because they are all related to a certain application. Within a vApp you can power on and off the VMs in the vApp in a particular order in one click and you can control the resources of a vApp.

















Here is a screen shot about memory entitlements in vSphere from the Documenation Center if you are looking for some quick reading.



SQL Saturday: #165 Lincoln

Had an awesome time at SQL Saturday #165 in Lincoln yesterday! Went down to Lincoln with a few co-workers and was able to see 3 co-workers from House of Brick Technologies present in different sessions. Great job David Pettengill, Andy Galbraith (@ DBA_ANDY) and David Klee (@kleegeek) on your presentations I enjoyed them all. This was my first SQL Saturday and it was a great experience, I love how the SQL Server community works together to help industry and technology progression.

A favorite presentation of mine yesterday was "SQL Server Internals: It's Whats for Dinner" by Christina Leo (@ChristinaLeo), it was very in depth presentation and very well pulled off. A theme of mine if you haven't read some of my other blog posts, is that I enjoy and appreciate simplicity, and her presentation was presented in a very simplistic easy to understand manner. When someone can explain a subject in such an easy to understand way, you know they know their stuff! She also used a pretty fun analogy comparing the internals of SQL Server to preparing and cooking a meal using a recipe...sounds nuts, but it was pretty awesome how she made it all relate. Great presentation Christina (who will probably never see my blog ;)).
Cant wait for SQL Saturday in Omaha April 6th!

Sunday, September 30, 2012

VCP5: Resources and Refrences for Study

The VCP5 exam is a well written and structured test. It was a surprisingly difficult exam, and I was caught off guard. Based on mock exams and practice exams I was taking, as one portion of my preparation, I should have blown the test right out of the water. I feel like nothing I had done had properly helped me prepare for the exam so because of that fact I felt a little mad when I had failed the test on try 1. So in an effort to provide a better reference and study companion for people interested in taking the VCP5 exam, I plan to write a large group of blog posts containing key topics and areas of focus that will aid in helping people understand what they are studying and why they should know the information presented to pass the exam.
I took the VMware 5.0 Fast Track course in Chicago about 6 months ago (if you dont know, attending a VMware certified course is a requirement for becoming certified). I must warn everyone, taking the classes will not provide you with 90% of the knowledge you need to pass the exam as my teacher so commonly mentioned. I consider the classes to give a person about 20% of what they need to know to pass the exam. If the exam asked questions like "How do I power on a VM", then sure, the class would give you sufficient knowledge to pass. But I will tell you, you wont find little baby questions like that on the exam :)
What you WILL find in the VCP exam is that topics are covered in a way that someone might say to them selves, "Well that was a twist on what I thought the question might be". For instance, someone might study how to set the Maximum Transmission Unit to allow for Jumbo Frames. They might know from start to finish how to set the MTU, on what object you can set the it, and that 9000 is the number to configure for Jumbo Frames. But when they sit down for the test it may ask what is the default MTU, and that person may have spent so much time focused on the Jumbo Frame MTU size that they totally spaced on the default size. This to me would be a perfect example of how VMware successfully "twists" the questions of the exam to determine if the examinee has a deeper understanding of the material.
The main purpose of this post is to provide a list of references that I found helpful in my study for taking the exam. Sooooo, BOOM!, here's a bulletted list containing those references:

  • My favorite reference for studying became the vSphere Documentation Center found here http://pubs.vmware.com/vsphere-50/index.jsp. A couple reasons why it was my favorite are that it is extensive and covers nearly ever topic, it is easy to understand, and most important is that it gives you steps to follow when troubleshooting common issues that a feature may have. The exam covers a lot of troubleshooting.
  • The VMware Knowledge base. Found here, http://kb.vmware.com, the VMware KB is such an awesome library. My method of study was to find a topic and then physically go through the steps in a lab I have availability to at work. When I would run into an error or couldn't quite get something, the KB was invaluable.
  • VMware vSphere Clustering Technical Deepdive by Duncan Epping and Frank Denneman was an awesome source for learning the internals of Clustering in vSphere.
  • The VCP5 Exam Blue Print Found here: http://communities.vmware.com/servlet/JiveServlet/previewBody/16726-102-7-23055/VCP510%20Exam%20Blueprint%20Guide%201.4.pdf. I used this to know what I NEEDED to know, and then I would go about doing it in the lab and documenting what I did using screen shots.
  • The Official VCP5 Certification Guide is a newly released book from VMware. If I had to summarize this book, I would say it is a more helpful version of the classes. I like how the author writes and enjoy his simplicity. The book comes with testing software which is nice, but very misleading because of how easy it is. The ebook version comes with even more testing software that is unfortunately misleadingly easy too.

I recommend having access to some degree of a vSphere lab, although I will not directly recommend using a production environment, if you only had access to that type of environment, create your self a read-only account so you can safely poke around and you wont have to be worried about accidentally hitting something you didnt want to! You do not necessarily need to be able to vMotion and enable FT, as long as you have done them before, but knowing where to find these features and know where to configure them coupled with the references above should be sufficient to be successful on the exam. Look for future posts where the title starts with VCP5, these will contain gold for studying. Good Luck!


Wednesday, September 26, 2012

VMware Certified Professional 5

It has been awhile since I composed a new blog post, there was a really good reason for it...I swear! I had been studying for quite awhile to take the VCP5 exam. If you have never attempted this test, be forewarned, it is extremely hard. I had studied super hard, I had even bought the new Official VCP5 Certification Guide published by VMware and blew through the book in a week, and felt very comfortable with my knowledge of the subjects found in it. The book comes with testing software and if you buy the "Special" edition eBook it comes with more advanced testing software than just the book comes with. I was blowing those mock exams, provided in the testing software, out of the water. I had been scoring 480 out of 500, and taking only 30 minutes to do it too. I thought I was set! I signed up and took the exam and I was metaphorically pants'd. My first attempt was a 275 out of 500, needing 300 to pass. I was surprised at the difficulty of the test, they truly want you to have a deep knowledge of the material and troubleshooting methods. I felt pretty frustrated because a lit if hard work had been done, but I knew I needed to change my preparation methods. The key for me was doing more hands on versus just reading more. I signed up for the next soonest exam date I could (you have to wait 7 days), and through a lot of hard work and help from my wife and co workers I passed the exam on 20th. I plan to share my studying techniques and, recommend in detail areas of study in my next few posts while it is fresh in my mind. Thanks to everyone who helped me get to this awesome milestone in my career, thanks to all of those co-workers at House of Brick Technologies who helped me out, answered questions when I had them, and was supportive of me taking on this exam, you know who you are! More to come on prepping for the exam! WOO HOO

Tuesday, September 4, 2012

Deep Dive: CPU Ready Time

In my last post we tackled the topic, "VMWare ESX/ESXi CPU Scheduler",with extreme prejudice, this week will be an extension of that post. Lets talk about CPU Ready Time, how bout' it? (if you said "No", Click Here...). To put it simply: CPU Ready time is your enemy, but, to give a more formal definition of what CPU Ready Time: CPU Ready Time is when a Virtual Machine exists in a state when it is ready for processor time but cannot be scheduled on the processor. The CPU is at a point when it is "Ready" for processor time. I mentioned in my last post that CPU Ready time can be a performance killer and over allocation of vCPUs is most likely at the heart of the problem. To throw some data and thoughts at you really quick, I love me a good bulleted list and I hope you do too:
  • When possible, keep like CPU allocated VMs on the same hosts or clusters. This will help reduce CPU Ready time to a safe amount. VMware suggests 5% CPU Ready time is within the safe limits for a VM to live with. We will discuss safe zones a little later in the post. Regardless of recommendations, everyone should establish their own safe and red zone numbers. Even ours don't coincide with VMware's recommendation.
  • An ESXi host will try its best to keep a VM's requests for processor time, running on the same physical cores for caching purposes. If the benefits of moving the VM's processors requests to new cores is more efficient than waiting for the CPU scheduling to allow for processor time (CPU Ready Time), the ESXi host will clear the processor cache and move the existing and new processor requests to different cores, this move takes time and the effects can be felt in performance but the host has determined this to be the better choice than to let it accumulate any more CPU Ready time.
  • Many times CPU over allocation occurs when P2V'ing a physical machine into your Virtual environment. Although your super serious amazing awesome database server needed 12 CPUs in the physical world, monitor overtime and determine how many of those you can knock out of the picture. Maybe it could be taken down to 8 or even 6 vCPUs. 
  • In many cases, I would bet that 60-75% of workloads can fit within the 1-2 vCPU range, and I would also put money on 75-90% of workloads needing no more than 4 vCPUs. As a side note: I was reading this article on Ars Technica and found some of the hypervisor host stats for Hyper-V compared against VMware, pretty crazy and honestly, unnecessary. By the time I need 320 CPU hosts (yay Hyper-V), I would have hoped I would have been smary enough and separated that load into multiple hosts and created maybe a new cluster for high availability instead. I don't doubt there are some massive companies with an insane virtual infrastructure that could benefit from that size of hosts, but most companies and workloads don't come close to that. END OF SIDE RANT.
  • I recommend keeping a close eye, however you go about doing that in your environment, on the CPU utilization and CPU Ready Time, and always look for opportunities to reduce vCPU assignment or create like allocated vCPU Virtual Machines.
  • If you have hosts or clusters that have a huge amount of resources that are barely getting used by the VMs in your environment, you may be able to get away with not caring to much about mixing like vCPU assigned VMs. The effects of CPU Ready time are being masked by the fact that there are a bunch of physical resources. Wait for your work load get up to a medium amount of usage and your performance will start to ache because of that hidden CPU Ready time. 
With my awesome bullet-ed (spell checker wanted a hyphen, lame!) list aside, lets take a look at what in the world was going on in the "cliff hanger" picture I left at the bottom of my last post. Here is it once more:








So what are we looking at here? This is obviously a vSphere performace chart, it is showing the CPU Usage and CPU Ready time for a production VMware View Connection Server. To make a long story as short as I can, I was looking at the currently assigned Memory for this machine when I noticed the VM had been assigned 4 vCPUS.











I thought to my self, "Why in the world does this VM need 4 vCPUs?" Turns out after reading some additional View documentation, 4 vCPUs is the default recommended setting. So anyways, I thought just for fun I would take a look at the CPU usage to see how much this baby was actually using  Here is what I initially saw once I enabled the CPU Ready chart metric:









This VM was getting CPU Ready times on the "Real-time" chart of 2,500 to 3,700 milliseconds consistently . Its one thing to get some bad CPU Ready time in a blip or moment, but this was consistent and "reliable" CPU Ready time. This VM's performance was basically getting destroyed. To put these numbers into perspective lets take a look at how to interpret these millisecond numbers. I recommend learning and understanding what good and bad millisecond values are for CPU Ready Time, since this is how the vSphere performance charts presents this metric. Many people want % values, which are not bad, but because vSphere charting goes off of millisecond, I find it more beneficial to read the millisecond value and know what they mean.

If you know anything about how VMware saves statistical data this wont be news to you. But when you look at any performance chart BUT the "Real-time" view or the "Refreshes every 20 seconds view", the numbers you see present you with what looks like "higher" numbers. This seems this way because the stats are rolled up and its actually an average of the statistics saved.

To further describe roll-up effect, here are some basics to work off of.
  • The "Real-time" performance chart is updated every 20 seconds. As a good base line, 120 - 175ms is acceptable for CPU Ready Time on the "Real-time" chart. 500 ms is our red zone. For those of you who want percentages here is the equation: 
    • <currentValueINMilliseconds>/<intervalINMilliseconds>*100
    • For example 170/20,000*100 which gives us a percentage of .8% CPU Ready time. 
    • Doing the math, so you dont have to, our red zone is about 2.5%.
  • The "Day" performance chart shows the rolled up statistics for a day in 5 minute intervals. So if our Real-time interval is 20 seconds and 500ms is the red zone, our 5 minute interval red zone would be 7500ms. 
    • (5*60/20)*500=7500.  OR to simplify. From here on out our red zone is 1500ms for every minute.
  • The "Week" performance chart shows the rolled up stats for a week in 30 minutes intervals. So 30*1500=45000 is the red zone for the week chart.
Although I could do the math, because I am wicked smart, I will let you all do the rest of the math for the Month and Year charts and for any custom charts you make. Make sure you check your stats intervals on your vCenter(s) as the defaults are not always used. Access the interval settings this from the "vCenters Settings" button on the home page inside of vCenter. Heres a screen shotters for assistance:



So let me finish the story from earlier about the View Connection Server I was monitoring. To sum things up really quickly, the "Real-Time" chart screen shot I shared earlier with 2,500 to 3,700ms means that for 16% of the time this VM was not able to do anything, it was just sitting there and waiting! When would numbers like that ever be acceptable?

INITIATE SCIENTIFIC STUDY BENCHMARKS

Advanced Scientific Study #1:
IT Manager: Why is this VM so dang slow?
IT Employee: Uhhhh, well it works 84% of the time...
Outcome: NOT ACCEPTABLE

Advanced Scientific Study #2:
PotentialCustomer: What kind of guarntee can we expect for up time if we decide to go with your facility?
PotentialDatacenterFacility: Uhhhh, we are up about 84% of the time around here...
Outcome: NOT ACCEPTABLE

Advanced Scientific Study #3:
Wife: How much do you love me?
Husband: Uhhhh, about 84%...
Outcome: DIVORCED

To finish up here (this post is SOOOO LONG) I asked for a downtime window from the customer, and went in and removed 2 vCPUs. The end result of removing those 2 vCPUs is what is shown in the initial screen shot highlighted by the "BOOM!". The CPU Ready time drops off and is almost non existent. One last picture, here is a screenshot showing the "Real-time" view with the CPU Ready metric active. This screenshot was taken about 30 minutes after I changed the vCPU assignment. Check out the dive CPU Ready time took, AWESOME.








I hope that this post has been a helpful tool in helping you understand CPU Ready time more fully. I hope the real world scenario described in the post helps tie it all together. Be a Monsterrrrrr at work, destroy CPU Ready time.