Welcome to TechNet Blogs Sign in | Join | Help

SE Tips and Tricks -- Save aTS Session Run Remote... Find Hyper V information

Editors Note: One the System Engineers that run the servers that host www.Microsoft.com told me that he wanted to start posting some of the methods and tips and tricks that they use when managing one of the most heavily visitied web site in the world.  This post kicks off this series. 

1) How to remotely find out if a machine has Hyper V is installed?

 

When you install the hyperv Role on windows 2008 it updates the BCD store (replacement of boot.ini in 2008 & Vista) of the machine with an entry "hypervisorlaunchtype" and sets it to auto. So you can remotely query the BCD store of a machine to find out if Hyper V is installed or not. 

 

Here is a quick way from command prompt you can use the following command if you have psexec in the system path . You can use WINRS too, but psexec seems to be easy.


psexec
\\machinename bcdedit | find "hyper"


e.g.) C:\>psexec \\hypervhost2k8 bcdedit | find "hyper"
 
PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals -
www.sysinternals.com
  
hypervisorlaunchtype    Auto
bcdedit exited on hypervhost2k8 with error code 0.
 

There are other quick ways too by checking existence of vmbus.sys, hvboot.sys and using WMI to query BCD.

 
2) How to remotely find out which is the Physical host of a VM?

 

In HyperV language physical host is a machine that hosts the root partition and guest will be called a

child partition installed on top of HyperV. You can remotely query the registry value HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters\hostname of the child partition to find out the machine name that hosts the root partition.
 
Here is command that can be run remotely 
 

reg query "
\\machinename\HKLM\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters" /V hostname 
 
 
e.g.) C:\>reg query "\\hypervguest01\HKLM\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters" /v   physicalHostName

 

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters

    PhysicalHostName    REG_SZ    hypervhost2k8

Posted by MSCOM | 1 Comments

Microsoft.com Operations Performance Analysis of IIS 7.0/Windows Server 2008

Now that Windows Server 2008 has been released earlier this year many enterprises are assessing the value proposition of moving to the Windows Server 2008 and IIS 7.0.  As an IT Pro or decision maker in this process you want real world working proof to make your decision clearer.  Sure, the new file based configuration system and modular architecture of IIS 7.0 make administrating your web servers a whole lot more flexible.  But how does it perform against its predecessor IIS 6.0 / Windows Server 2003?

 

Microsoft.com Operations has been an early and active adopters of IIS 7.0 / Windows Server 2008.  We actually started running a single server on the www.microsoft.com site back in June 2005.  We set out to answer this question.  Is IIS 7.0 / Windows Server 2008 more performant then IIS 6.0 / Windows Server 2003?  We performed a side by side performance analysis on the www.microsoft.com site which was taking live internet traffic during peak traffic hours.

 

During this performance assessment we found that the CPU usage was higher on Microsoft Windows Server 2008 RTM servers, which is driven by the higher number of RPS the servers were handling.  As mentioned below the hardware load balancers are sending more traffic to the Windows Server 2008 RTM servers (31% more RPS) as they are completing the outstanding web requests faster than the W2K3 SP2 server.  A good metric listed below is the “efficiency” or “cost” of the number of requests per CPU cycle (RPS / CPU Utilization %).  Using this metric, IIS 7.0/W2K8 RTM is over 10% more efficient then IIS 6.0/WS03 SP2 in handling live web platform traffic for the www.microsoft.com site.

 

Listed below the graphical data results is the methodology used in this performance analysis.

Performance Metrics

W2K3 SP2

WS2K8 RTM

Change

RPS / CPU Utilization (%) =  Requests per CPU Cycle

4.36

4.84

10.9%

 

 

W2K3 SP2

W2K8 RTM

Change

Performance Indicators

A

B

(A-B)/A

CPU Utilization (%)

44.8%

52.8%

-17.9%

Web Service -Total Methods Requests/Sec “RPS”

194

255

31.4%

Web Service – Current Connections

280

294

5.0%

Load Balancing –  Current Client Connections

116

116

.NET CLR Memory – % Time in GC

1.1%

2.5%

 

Server Efficiency (RPS/ CPU %) – Efficiency of serving live web platform traffic

W2K3 SP2     4.36   requests per CPU cycle”

W2K8 RTM   4.84   ~ 10.9% increased efficiency

 SRV Efficiency

 

CPU Utilization (%)

W2K3 SP2     44.8%

W2K8 RTM   52.8%   ~ 17.9% degradation (This is impacted by the increased RPS the W2K8 servers are handling)

 CPU Utilization

 

Web Service – Total Methods Requests/Sec (RPS)

W2K3 SP2     194

W2K8 RTM    255   ~ 31.4% more traffic is being sent to the W2K8 RTM servers

 Web Svc Total Methods

 

Web Service – Current Connections

W2K3 SP2     280

W2K8 RTM   294   ~ 5% increase

 WEBSvc Current Connections

 Load Balancing – Current Client Connections

W2K3 SP2     116

W2K8 RTM   116   Equal – as the hardware load balancer maintains the same amount of outstanding open client connections.

 HW Load Balancing 

.NET CLR Memory – % Time in GC

W2K3 SP2    1.1%

W2K8 RTM   2.5%  No significant degradation in “Time in GC”

.Net CLR Memory 

 

Performance Overview and methodology:

Site: www.microsoft.com 

During this assessment the live www.microsoft.com site was comprised on 80 servers.  There were four load balanced clusters of twenty servers each, located in multiple datacenters.  This performance analysis was developed by using a single twenty server cluster on the www.microsoft.com site.  The cluster is comprised of 19 Windows Server 2008 RTM servers (W2K8 RTM) and a single Windows Server 2003 SP2 (W2K3 SP2) server all taking live internet facing traffic.  This Lone Windows Server 2003 has become quite famous.  In fact, he actually has his own blog located at http://blogs.technet.com/windowsserver/pages/about-lone-server.aspx

 

Hardware:

  Model: HP DL585 G1 (4 dual-core CPUs)

  RAM: 32GB 

 

OS:

 Windows Server 2008 RTM (Build: 6.0.6001.18000) Enterprise version x64

 

Load Balancing:

We are using a hardware load balancing solution.  The load balancing algorithm we are using is based on “Least Current Client Connections” to each load balanced member server of the cluster (not round robin, or other any other load balancing algorithms).  The hardware load balancer will maintain the same number of current client connections to each member of the cluster.  So if a W2K8 server is completing web requests faster than a W2K3 server, the load balancer will send more traffic to the server W2K8 RTM server.

 

Methodology:

We gathered performance monitor logs for 72 hours during peak traffic (Monday - Wednesday) for a cluster of www.microsoft.com web servers.  In all the charts above the W2K8 RTM data is based on an average of all the W2K8 RTM servers in a single cluster.  While the W2K3 SP2 data is based on the single (Lone) server that was in rotation.

Posted by MSCOM | 9 Comments

New IIS 7.0 White Paper…Internet Information Services 7.0 in Windows Server 2008 Provides an Improved Web and Application Platform

This paper discusses the management, security, performance and extensibility improvements when Windows Server 2008 is deployed to host and manage applications and services that run on the server and/or over the Web. Check it out on this TechNet link!
Posted by MSCOM | 1 Comments

Modern .NET Development and The Joy of Simple LINQ to SQL

Introduction – Modern .NET Development

It took me a while to realize it, but Microsoft .NET application development has significantly evolved in the past year and a half. This is not your dad’s .NET. The following releases have added many considerable advances in .NET application development technologies:

                                               

Microsoft Product

Release Date

Major Features

.NET Framework version 3.0

November 11th, 2006

WPF, WCF

Silverlight version 1.0

September 5th, 2007

XAML rendering for web applications, JavaScript API

.NET Framework version 3.5

November 19th, 2007

Language integrated query (LINQ)

Visual Studio 2008

November 19th, 2007

IDE for all things .NET

Silverlight version 2.0

Beta 1 on March 5, 2008, RTM late summer 2008

Managed CLR, C#, .NET Framework, greater parity with WPF XAML

Expression Blend

v1 May 2007, v2 beta March 2008

XAML user experience (UX) IDE

 

If you fancy yourself an adept .NET developer, you had better be ramped up on these new technologies.

Today, if you are considering user interface/experience development, you should consider leveraging the rich UX elements and platform independence offered by Silverlight, and the power of authoring with the Expression Studio. If you are designing some middleware, you should consider developing software services using Windows Communication Foundation (WCF) technology. For coding backend data access it is now wise to evaluate LINQ to Entities or LINQ to SQL techniques. And before you write any C# foreach loop on an array or other collection, you might be able to write it better using LINQ to Objects techniques instead.

The bottom line here is that .NET developers have many new tools available to leverage for developing just about any application. Using these new techniques should eventually accelerate the delivery of applications that look better and are better-built. I say “eventually” because these new tricks will take some ramp up time to learn and master. And first, the developer needs to be aware of them and know how to judiciously leverage them.

However, we are talking about a pretty big load of new stuff to digest here. So let us discuss just one example of one these new tricks: LINQ to SQL. The primary purpose of rest of this article is to illustrate one simple example application of LINQ to SQL.

 

Simple LINQ to SQL

A couple of months ago, I was tasked with developing an internal application that would periodically transfer some data from a SQL database into a monitoring system. The SQL database was a Hewlett Packard Systems Insight Manager installation. The monitoring system is a Microsoft Systems Center Operations Manager (SCOM) 2007 installation, accessed via the System Center Operations Manager 2007 SDK, and the Microsoft.EnterpriseManagement Namespace.

LINQ to SQL is well-suited for this situation as it helps avoid changing either the source or destination installations, and with a minimal “footprint” of moving parts. With a single stand-alone console application, I was able to get this job done, and with a not-too-kludgey implementation. I developed a single, modest-length class file to do the whole thing, with no hard-coded transact SQL code!

I won’t drag you through my entire solution. I pared down the code to illustrate just the LINQ to SQL mechanics, as run against that Hewlett Packard Systems Insight Manager installation:

using System;

using System.Data.Linq;

using System.Data.Linq.Mapping;

using System.Data.Linq;

 

namespace LinqLite

{

    class Program

    {

        static void Main(string[] args)

        {

            DataContext db = new DataContext("YOUR HPSIM SQL SERVER CONNECTION STRING GOES HERE");

            Table<CIM_Chassis> TableCIM_Chassis = db.GetTable<CIM_Chassis>();

            Table<Devices> TableDevices = db.GetTable<Devices>();

            Table<Notices> TableNotices = db.GetTable<Notices>();

            var LinqQuery = from c in TableCIM_Chassis

                            join d in TableDevices on c.NodeID equals d.DeviceKey

                            join n in TableNotices on d.DeviceKey equals n.DeviceKey

                            where n.NoticeId > 35000    //TODO: make this a LastIdProcessed variable

                            orderby n.NoticeId

                            select new { n.NoticeId, n.NoticeSeverity, n.Generated, n.Comments, d.DeviceKey, d.ProductName, d.Name };

 

            foreach (var qdata in LinqQuery)

                Console.WriteLine(string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}"

                    , qdata.NoticeId

                    , qdata.NoticeSeverity

                    , qdata.Generated

                    , qdata.Comments

                    , qdata.DeviceKey

                    , qdata.ProductName

                    , qdata.Name

                ));

            Console.ReadLine();

        }

    }

 

    [Table]

    class CIM_Chassis

    {

        [Column] public long NodeID = 0;

    }

    [Table]

    class Devices

    {

        [Column] public int DeviceKey = 0;

        [Column] public string ProductName = string.Empty;

        [Column] public string Name = string.Empty;

    }

    [Table]

    class Notices

    {

        [Column] public int NoticeId = 0;

        [Column] public int NoticeSeverity = 0;

        [Column] public long Generated = 0;

        [Column] public string Comments = string.Empty;

        [Column] public int DeviceKey = 0;

    }

}

 

I call this solution simple LINQ to SQL primarily because it is all done in one code file, and does not involve using the fancy Visual Studio 2008 Object Relational Designer (O/R Designer). When you use the O/R Designer, you get a handy GUI for assembling some classes that map to the SQL data. You can easily end up with several auto-generated class files with many code stubs, just in case you might need them.   You use these classes in your LINQ queries to access the data. But if you are doing simple read-only selections, you can hand-code the classes, make them lean, and place them in-line in the code, like I did:

    [Table]

    class CIM_Chassis

    {

        [Column] public long NodeID = 0;

    }

    [Table]

    class Devices

    {

        [Column] public int DeviceKey = 0;

        [Column] public string ProductName = string.Empty;

        [Column] public string Name = string.Empty;

    }

    [Table]

    class Notices

    {