Hyper-V-less What a Result

As part of a ‘dev’ machine setup, I run on my latop Win2008R2 x64 Hyper-V…why? to simply run x64 hosts.
Virtual PC, Virtual Server – will run on x64, but not host x64 O/Ss. So really the
only option is Hyper-V in the MS land.

I present, demo + and draw all over my tablet screen on a regular basis as well as
cut code in Server O/S.

The main problems I faced:
– was my display was dog slow, especially running VS2010, ppt or generally
anything else that an average user might do.
– I remove the Hyper-V role off my machine and low and behold it’s back to normal.

A student pointed me to a TechNet article – http://support.microsoft.com/kb/961661 in
which the resolution is to install a VGA Display driver.

This is kinda not an option for me presenting etc.

Still I needed to run those x64 bit guests.
I was contemplating getting a monster laptop (the other day I was training with laptops
that had 8GB of RAM, 6GB allocated to the VM!) or setting up various ‘Demo RDP Connections’
back into the office, so when I’m onsite and I need to demo then (somehow) I can get
internet connectivity and RDP back to a server based VM – lot’s of potential issues
with this approach)

So the MS Story in this space at the moment is:

– 1) you want to run 32-bit hosts, VirtualPC or Virtual Server running on x64 or x86.
Only x86 guests!
– 2) you want 64-bit hosts -> Hyper-V (therefore you’re looking at running
Win2K8/R2). At work we have 15+ VMs running on Hyper-V machines really well, so no
complaints there when running on Servers. It’s just running it on my laptop where’s
it’s not special.

Problem is – going fwd, the latest wave of Server Products, SharePoint 2010,
Exchange 2010, CRM 5 etc….only run on x64

So onto to my unbelievable experience….

Last night I caught up with a couple of buddies Andrew Mee and Guy Riddle, where Guy
mentioned all the pain he’d had in trying to get a x64 but guest up and running on
his laptop.

Guy mentioned his setup:
1) Win7x64
2) VirtualBox – for VM emulation – WITH USB
SUPPORT!!!! wow! In the land of BizTalk RFID, I had major issues with USB devices
trying to be picked up inside the VM – 3rd party solutions etc. crazy.

He mentioned there were a few things to do around the disks etc…but he could run
x64 guests on his Win7 machine AND the VMs FLEW!

So I thought there was a touch of the amber fluid talking and maybe he was indeed
onto something. When I got home later that night I decided tonight was the night to
refresh the laptop (fujitsu lifebook t4215/4GB/T7400) and Install Win7x64.

My potential issue with Virtual Box:
I have a huge library of VHDs (parents, diffs etc) that for portability suites
me down to the ground. I walk into a training room and can transfer my VHDs to the
student machines and run them no hassles.
– If there’s a VirtualBox specific format (VDI) then it yet another step in my export
chain.

Alas – VirtualBox reads/writes VHDs automatically, unbelievable.

So I setup Win7x64 on my latop and got back to 9 sec bootup and shutdown times 🙂
– gee that was refreshing after so long without.

I installed VirtualBox – it installed like a treat, and does ‘snapshots’ and has a
great user interface. I didn’t need to visit the cmd line once.

So now for the test – I was going to fire up my SP2010 Beta2 (Win2K8 R2 x64) VHDs,
40GB in size, differencing and Parent, straight from Hyper-V with Hyper-V extensions (in
the past when I’ve done something like this, there’s usually a blue screen invovled
saying ‘boot device not found’)

Let’s give it a crack I thought – all from the UI.
1) Within VirtualBox, I created a machine, added 2 CPUs, 1 NIC and 1400MB of RAM.
2) Attached the Child VHD from my SP2010.
3) I even had 3D graphic acceleration options for my VM, along with amd-v and ‘nested
tables’ for some sort of faster memory access. Turn them all on I thought! We’ll put
it through its paces.

Started the machine……

  1. upon first boot my hyper-v enabled VM booted straight up to the Login screen! Unbelievable I
    thought.
  2. logged in and it found my NIC within 10 secs and was on the network within 20 secs
    (through NAT). If you’ve ever experienced a Hyper-V update where your Guests don’t
    talk to the network anymore, until you put the new hyper-v additions on – you’ll know
    the pain.
  3. mouse/keyboard recognised.
  4. I then thought – let me install the VirtualBox additions – can’t hurt.
  5. RDP support etc etc …it’s like shopping @ christmas – how good is this! yes I’ll
    have that…and this…

    So back to Guy’s immortal words – “it runs fast. Snappy, responsive
    etc”



    My SP2010B2 in 1.4GB RAM x64 VM runs fanstastic!
    – Fastest I’ve seen a VM run
    on my laptop for a long long time (unless it’s WFW 3.11)

It’s just so refreshing to have a responsive VM running in reasonable memory. I found
that if I allocated 2.5GB to a VM under hyper-v I wouldn’t notice a marked improvement.
It’s not like it flew, and then I had to tweak it back to find that ‘optimum sweet
spot’

What an experience! What I’m seeing is that certainly for the desktop machine, VirtualBox
can be a serious contender for x64 guests.

Thanks Guy for planting the seed!!!

Dublin finally gets a name "Windows Server AppFabric"

We’re moving into a public beta of Dublin “Windows Server AppFabric”
which you can grab from HERE.

What does it mean – here’s a blurb from the site.

So Velocity (distributed caching mechanism) is rolled up into this Beta (previously
a MS Partner did some benchmarking on Velocity which you can find a great white paper HERE)

Previously myself and Scotty wrote a
hefty technical Dublin Course which the folks at TechEd loved – we did this on some
early bits of ‘Dublin’. Realtime monitoring + tracking as well as recoverability were
some highlights of our 3D Realtime maze process we built up in the labs.

Here’s a blurb from the AppFabric server (it’s a shame that SP2010 didn’t use this
framework for it’s WF hosting…but that would have impacted delivery)

Enjoy

——– Snippet ———-

Windows Server AppFabric has these core capabilities:

  • For Web applications, AppFabric provides caching capabilities to
    provide high-speed access, scale, and high availability to application data. This
    feature was previously codenamed “Velocity”
  • For composite applications, AppFabric makes it easier to build and manage
    services
    built using Windows
    Workflow Foundation
    and Windows
    Communication Foundation
    . This feature was previously codenamed “Dublin.”

The WCF services ecosystem

At PDC, Microsoft announced the rebranding of ADO.NET Data Services as WCF Data Services and of .NET RIA Services as WCF RIA Services. This is not just a product marketing decision – it is also a technical commitment to provide a coherent and unified services story on .NET.


The current implementations of ADO.NET Data Services (previously known as Codename ’Astoria’) and .NET RIA Services (previously known as Codename ’Alexandria’) are based on WCF.  In fact, they are WCF services. Moving forward, future releases will align the technologies to allow features of the technologies to be used in a mix and match manner as appropriate. We are currently in early stages of investigation around potential areas of deeper integration such enabling WCF RIA services to support an appropriate subset of ADO.NET Data Service’s Open Data protocol (OData); enabling validation features that are currently only available in WCF RIA Services in other flavors of WCF services as well etc.


By unifying these services offerings on top of WCF, we are maximizing developer knowledge transfer and skill reuse in the short term and the long term. For the WCF RIA Services developer, the developer does not need to know all aspects of WCF to get their service up and running.  However, if they want to add a WCF behavior or take advantage of the rich extensibility of WCF to their WCF RIA Service, they can choose to do so in a fashion that takes advantage of the unified communications programming model that is WCF.


Thus, as a result of this alignment, .NET will offer several different flavors of WCF services (listed below) that you can choose from based on your particular needs.  The important thing to remember is these options will all build on the underlying WCF architecture. As such these are not binary choices – providing the .NET service developer with a choice among three different entry points into a single distributed programming framework, rather than a choice among three different programming options.  We expect many applications will leverage multiple models for building out their applications and their developer’s knowledge will easily transfer from one model to the other.




%u00b7 WCF Core Services – Allows full flexibility for building operation-centric services.  This includes industry standard interop, as well as channel and host plug-ability.  Use this for operation-based services which need to do things such as interop with Java, be consumed by multiple clients, flow transactions, use message based security, perform advanced messaging patterns like duplex, use transports or channels in addition to HTTP, or host in processes outside of IIS.


%u00b7 WCF WebHttp/AJAX Services – Is best when you are exposing operation-centric HTTP services to be deployed at web scale or are building a RESTful service and want full control over the URI/format/protocol.


%u00b7 WCF Data Services – Including a rich implementation of OData for .NET, Data Services are best when you are exposing your data model and associated logic through a RESTful interface


%u00b7 WCF Workflow Services – Is best for long running, durable operations or where the specification and enforcement of operation sequencing is important


%u00b7 WCF RIA Services – is best for building an end-to-end Silverlight application


If you want to learn more about the different WCF services at PDC please check out the following sessions:




  • FT13   What’s New for Windows Communication Foundation


  • FT55   Developing REST Applications with the .NET Framework


  • CL06   Networking and Web Services in Silverlight


  • CL07   Mastering Microsoft .NET RIA Services


  • CL21   Building Amazing Business Applications with Microsoft Silverlight and Microsoft .NET RIA Services


  • FT10   Evolving ADO.NET Entity Framework in .NET 4 and Beyond


  • FT12   ADO.NET Data Services: What’s new with the RESTful data services framework


Thanks, and looking forward to your feedback!

New Web Services features in Silverlight 4 Beta

Cross-posted from the Silverlight Web Services Team Blog. 


This morning at PDC ’09 ScottGu just announced the availability of Silverlight 4 Beta. Later on today I am going on to present the latest improvements around networking and web services and I’ll link to the full talk as soon as it is available online. In this post I’ll provide a quick summary of today’s announcements, with more detail to follow.


On the high level, we are announcing an exciting alignment between the different web services stacks in Silverlight. ADO.NET Data Services and .NET RIA Services are being rebranded as WCF Data Services and WCF RIA Services to reflect the fact that both technologies are being built out as programming models on top of WCF. In a way, this is not really major news; to you as a developer, pretty much everything stays the same, and you can continue using your favorite technology, whether it is straight WCF, or WCF RIA Services or WCF Data Services.


RIA Services and Data Services give you productive patterns for specific kinds of services and applications, hiding away some of the complexity of using WCF directly. The power of WCF is still there for you under the covers, if you need to modify some setting to your liking.


Specifically within the core WCF model, Silverlight 4 Beta has support for a brand new binding: NetTcp. This binding lets Silverlight talk to WCF services using a high-performance TCP pipe, using a duplex message pattern. In Silverlight, the binding is built on top of the sockets support that’s already there since Silverlight 2, so we inherit the security requirements of the Silverlight sockets API. More specifically, the service needs to be hosted in a given port range (4502 – 4534) and needs to expose a policy responder on port 943. One more thing to be aware of is that the security support and the streamed programming model for NetTcp available in WCF on the desktop framework are not available in Silverlight 4 Beta.


We’ll have a lot more content for you coming up soon, including the code from my talk today. If you want to get your hands dirty right away, go get the Silverlight 4 Beta, and then try the steps this how-to in our MSDN documentation, which has already been updated and show usage for NetTcp.


More information:



Thanks, and looking forward to your feedback!
Yavor Georgiev
Program Manager, Silverlight
 

Processing an Excel upload with nServiceBus

v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}

Normal
0
false

false
false
false

EN-GB
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
mso-pagination:widow-orphan;
font-size:11.0pt;
mso-bidi-font-size:10.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}

[Source: http://geekswithblogs.net/EltonStoneman]

We’ve had a couple of projects recently with similar requirements to process an Excel file as a batch upload of data. One was a BizTalk project where the FarPoint Spread pipeline component was a good fit; the other was a Web app where we put together a custom parser based on the open-source ExcelDataReader. The custom solution was appropriate for the expected size of upload files, but wouldn’t scale well to deal with large files quickly, so I wanted to look at a distributed alternative using nServiceBus. My sample implementation is on MSDN Code Gallery here: nServiceBus Excel Upload. I’ll look at a comparative BizTalk solution in a future post.

If you haven’t come across nServiceBus, it’s a queue-based messaging framework which is inherently asynchronous. “Scalability and reliability are in its DNA”, and it has some impressive case studies. Using nServiceBus you can set up a simple publish-subscribe architecture between nodes, or a load-balanced architecture with a central distributor. In the distributed version, the upload sample looks like this:

(Note that the diagram represents the bus as a separate entity, in reality it’s distributed among the queues of all the nodes. The diagram also omits the distributor).

In nServiceBus, services are requested by publishing messages onto the bus. Requests are fulfilled by a handler which subscribes to a type of message. The Excel upload sample takes a workbook which contains a set of products and uploads them to the AdventureWorks database. There are three types of message:

  • StartBatchUpload – published when a file has been received and is ready to be processed; subscriber does some basic validation on the Excel data structure, and then for each row in the worksheet publishes an AddProduct message;
  • AddProduct – subscriber maps the product defined in the message to a stored procedure call which inserts the new product. When the last product in the batch is reached, sends a BatchStatusChanged message to the original publisher of the StartBatchUpload message;
  • BatchStatusChanged – logs the status change and renames the Excel upload file.

This is a basic example, more validation would be expected, but the workflow is representative. Parsing the Excel file is done quickly, allowing for any number of nodes to participate in the resource-intensive work of creating the products. Using a single host with 5 threads, an Excel file with 3,500 rows takes just over 4 minutes to process on a dev laptop. That’s 13 messages per second which is nothing special, but this is on a single host which is also running the distributor and SQL Server. The processing host has a flat memory profile (consistently around 40Mb) and runs at less than 20% CPU. The distributor takes around 15% CPU, and MSMQ another 15%.

For a much larger upload – 12,000 rows – the processing and memory profile is the same, and the upload takes around 14 minutes (~14 messages per second) on the same infrastructure.

Running the Sample

Access to a SQL Server instance with the AdventureWorks sample database installed is a pre-requisite. You’ll need to add the new stored procedure with uspInsertProduct.CREATE.sql. The connection string used by the host is specified in ExcelUpload.Host.exe.config (defaults to unnamed local instance).

You’ll need MSMQ running on all nodes. Queues are specified in configuration and are created by nServiceBus if they don’t exist – an exception is the storage queue for the distributor which needs to be manually created, this PowerShell snippet will do it:

[Reflection.Assembly]::LoadWithPartialName(“System.Messaging”)

[System.Messaging.MessageQueue]::Create(“.\Private$\distributorStorage”, $true)

Unzip the file ExcelUpload.Binaries.zip. You’ll have a batch file – start.cmd – and five subdirectories – Client, Host, Distributor, SampleFiles and Drops. Run start.cmd, check the console screens for errors, then copy one of the Excel files from SampleFiles to Drops. You should see activity in the host, client and distributor console screens, and new rows being added to the [Production].[Product] table.

If you drop the same file twice, the unique key on Products will be violated, so the upload will error. On a fresh install there are under 1000 products, so this resets the table to the default state:

delete [Production].[Product] where ProductID > 999;

Implementation Details

The sample uses the release version of nServiceBus – 1.9 – as the distributor was broken in the 2.0 beta at the time of writing.

The two console apps run the “client” (which monitors a configured file location for an Excel drop, and publishes the StartBatchUpload message), and the “host” (which subscribes to StartBatchUpload and publishes AddProduct and BatchStatusChanged messages). Both use Topshelf so they can run as a console, or can be installed as a Windows service (e.g. ExcelUpload.Client.exe /install).

If you want to run several hosts on the same machine, they will need to use different queues. Copy the whole of the Host directory, and modify ExcelUpload.Host.exe.config to specify a unique queue name:

InputQueue=ExcelUpload.Service.1.InputQueue

Then run ExcelUpload.Host.exe from all the copied locations, and you’ll see the console hosts sharing the message processing when a file is dropped.

BizTalk: xpath: How to work with empty and Null elements in Orchestration

The problem is with three Empty-Null cases.
Is it possible to separate all these cases in Expression shapes of the Orchestration?
For example, we have the record with <name> element, in such flawors:

case: “NonEmpty”

<ns0:People>
<
ns0:Name>Name_0</ns0:Name>
<
ns0:IsDependent>IsDependent_0</ns0:IsDependent>
..

case: “Empty”

<ns0:People>
<
ns0:Name></ns0:Name>
<
ns0:IsDependent>IsDependent_0</ns0:IsDependent>
..

case: “OneTag”

<ns0:People>
<
ns0:Name/>
<
ns0:IsDependent>IsDependent_0</ns0:IsDependent>
..

case: “Null”

<ns0:People>
<!– NO NODE: <ns0:Name>Name_0</ns0:Name>–>
<ns0:IsDependent>IsDependent_0</ns0:IsDependent>
..

Is it possible to separate all these cases in Expression shapes of the Orchestration?

There is no informationinto theMSDN about this [http://msdn.microsoft.com/en-us/library/aa561906(BTS.10).aspx]

I tried to use the xpath() function in two variants, one with “string(xpath_expression)” second with “xpath_expression”

Expression Shape:
[
System.Diagnostics.Trace.WriteLine(“======================================================================”);
System.Diagnostics.Trace.WriteLine(“[” + System.Convert.ToString(xpath (msg_SourceRoot, “string(/*[local-name()=’Root’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’People’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’Name’ and namespace-uri()=’http://MapTest.IncPerson’])”)) + “]”);

if ( xpath (msg_SourceRoot, “string(/*[local-name()=’Root’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’People’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’Name’ and namespace-uri()=’http://MapTest.IncPerson’])”) == null)
{ System.Diagnostics.Trace.WriteLine(“Name == null”); }

else if ( xpath (msg_SourceRoot, “string(/*[local-name()=’Root’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’People’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’Name’ and namespace-uri()=’http://MapTest.IncPerson’])”) == “”)
{ System.Diagnostics.Trace.WriteLine(“Name == Empty”);}

else
{ System.Diagnostics.Trace.WriteLine(“Name != null && Name != Empty”); }
System.Diagnostics.Trace.WriteLine(“———————————————————————-“);
System.Diagnostics.Trace.WriteLine(“[” + System.Convert.ToString(xpath (msg_SourceRoot, “/*[local-name()=’Root’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’People’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’Name’ and namespace-uri()=’http://MapTest.IncPerson’]”)) + “]”);

if ( xpath (msg_SourceRoot, “/*[local-name()=’Root’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’People’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’Name’ and namespace-uri()=’http://MapTest.IncPerson’]”) == null)
{ System.Diagnostics.Trace.WriteLine(“Name == null”); }

else if ( xpath (msg_SourceRoot, “/*[local-name()=’Root’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’People’ and namespace-uri()=’http://MapTest.IncPerson’]/*[local-name()=’Name’ and namespace-uri()=’http://MapTest.IncPerson’]”) == “”)
{ System.Diagnostics.Trace.WriteLine(“Name == Empty”); }
else
{ System.Diagnostics.Trace.WriteLine(“Name != null && Name != Empty”);}
]

I.e. in thefirs section used the “string(xpath_expression)” expression, in thesecond used the”xpath_expression”

Result is:

“NonEmpty” ======================================================================
[Name_0]
Name != null && Name != Empty
———————————————————————-
[Microsoft.XLANGs.Core.Part+ArrayBasedXmlNodeList]
Name != null && Name != Empty

“Empty”======================================================================
[]
Name == Empty
———————————————————————-
[Microsoft.XLANGs.Core.Part+ArrayBasedXmlNodeList]
Name != null && Name != Empty

“OneTag”======================================================================
[]
Name == Empty
———————————————————————-
[Microsoft.XLANGs.Core.Part+ArrayBasedXmlNodeList]
Name != null && Name != Empty

“Null”======================================================================
[]
Name == Empty
———————————————————————-
[]
Name == null

Conclusion:
* I cannot separate the cases “Empty” and “OneTag”
* I can separate the cases “Empty and “Null” with “xpath_expression”, not with “string(xpath_expression)” expression
* “Null” case does not throw an exception.