Windows Azure: Virtual Machines & Affinity Groups

I’ve been working with Windows Azure Virtual Machines recently and they are great. I initially worked with them when they were still in preview mode and they were not as stable and robust as they are now. One of the most interesting features is the ability to re-configure them by just selecting the new characteristics from a dropdown.

image

As you can see we have many different options from a very small instance that shares CPU cores up to a dedicated 8 core & 56GB instance. If you’re concern is the price, well, just take a look at the pricing page for details, but in general prices are now very reasonable for those types of configurations.

A very strange situation happened to me a few days ago when I was trying upgrade a Large (4 cores, 7GB memory) instance to an A6 instance (4 cores, 28 GB memory). All I needed was more RAM so I went ahead and selected the new size and… wait… an error?!

Unable to upgrade the deployment. The requested VM size may not be available in the resources supporting the existing deployment.

I could not believe my eyes! Wait, did I just hit my max allowed cores? This particular subscription has several virtual machines and you should know you can only have up to 20 cores in use at any given time, in addition, you can only have up to 20 storage accounts and up to 20 cloud services per subscription, but this subscription looked like:

image

Besides, I was keeping the same amount of cores, just upgrading the RAM, so it didn’t make any sense. I tried different things:

First Attempt

Just upgrading as normal. This is where I first saw the error.

Second Attempt

I shut-down the VM and then to my surprise I was able to upgrade, but when I tried to restart it the error showed up again. I changed the configuration back and the VM started work normally.

Third Attempt

Twitter! I asked if anyone knew about this and specifically send the tweet to Robin Shahan and Scott Hanselman. Robin in turn contacted Neil Mackenzie. It’s amazing how you can get in touch with two Windows Azure MVPs in a matter of minutes.

Neil mentioned something that I wasn’t aware of: High-memory instances (A5, A6, A7) are not available in all clusters. I was in awe! How could that be? Well, as it turns out it makes sense. High-memory instances were just recently launched and therefore not available in every single cluster. Now, how can I be sure of this? He then went on to also mentioned that I could check the affinity group to verify if high-memory instances were available. But I created the VM without an affinity group, so I was sure there wasn’t any. This was a problem, as Neil pointed out, and quoting him exactly:

If a VM cannot be upgraded because of cluster age I don’t think there is any way to access high-memory without a migration into a new cluster (i.e., create new and delete old).

He also made sure I understood why it was needed to create the VM with an affinity group:

You can create a VM without the use of an affinity group – although one is recommended ot ensure that you keep compute and storage co-located in the datacenter. However, an affinity group is necessary if you want to use a VNET.

A motivation for creating an affinity group in this particular case – desire for high-memory instances – is that Microsoft has indicated that you WILL have access to high-memory instances in newly created affinity groups.

If you create a new affinity group, you should be able to:

  • create a new affinity group
  • create a new storage account in it
  • shutdown your instances
  • copy the VHDs to the new storage account
  • create a new cloud service in the new affinity group
  • create a new instance with the old VHDs in the new affinity group

More Theory

Robin also came to the rescue when I asked: What if I just re-create the VM without moving the VHDs making sure I create it in an affinity group? She said:

Whenever you create a VM in an affinity group, it assigns it to a high memory cluster. This is basically a hack to ensure that you get a high-memory cluster, even if you only have one VM in your affinity group.

You can’t add a current storage account to an affinity group, you have to assign it to the affinity group when you create the storage account. That’s why you have to create and use a new storage account.

And to complement, Neil said:

An affinity group is a way to co-locate compute and storage. You specify the affinity group instead of the datacenter when you create a cloud service or storage account. You can’t merely copy a cloud service or a storage account into an affinity group since they may not be in the same part of the datacenter. You need to create new cloud services and storage accounts and redeploy the compute and copy the data.

The reason for all of this was that my storage account as well as the cloud service were not in an affinity group either, so there was no guarantee that by just re-creating the VM in an affinity group, high-memory instances were going to be available.

Solution

So basically what I did was just follow Neil’s instructions. I needed to make sure the storage account where the VHDs were, as well as the cloud service and VM needed to be in an affinity group to guarantee that high-memory instances are going to be available.

The process is as follows:

  • Create a new affinity group: Go to Azure Portal, then scroll down to Settings and select Affinity Groups. Then click in the Add button at the bottom. image

 

  • Create a new storage account: Scroll up to Storage and click on the + New. Then select Data Services –> Storage –> Quick Create. Make sure you select your new affinity group in the Location/Affinity Group field. image

 

  • Shut down the VM: Scroll to Virtual Machines, then select the VM you want and click on the Shut Down button. This will de-allocate the IP address so make sure you re-configure any DNS pointers to this VM. image

 

  • Delete the VM but keep the attached disks image

  • Copy the VHDs to the new storage account: This process is a bit elaborated and is discussed in a different post.
  • Create new disks for the VHDs: Scroll up to Virtual Machines and select the Disks tab. Add a new disk based on the VHD that has the operating system and ensure you checked the option to indicate Azure that it is a VHD with an OS. Repeat the same for the other disks (if any) but don’t check the option for an OS VHD. image

 

  • Re-create the cloud service to make sure it is located in the affinity group you just created: Scroll down to Cloud Services, then select the cloud service, click delete and then re-create it. image

 

  • Create the VM: Scroll back up again to Virtual Machines and select + New. Then select Compute –> Virtual Machine. Ensure you are using the “From Gallery” option this time because you need to select the OS disk you just created. In the location/affinity group field, make sure you select the new affinity group. Also, remember to re-attach the other disks (if any). image

 

  • Set the size of the VM to the desired high-memory instance.
  • Presto! You have now a high-memory virtual machine.

Thanks to Robin Shahan and Neil Mackenzie for their invaluable help in this process.

I hope this will help you understand why you need affinity groups and if you haven’t use them how to move your resources to use one.

Other Resources

Book: Pro Telerik ASP.NET and Silverlight Controls

Hi all.

It’s been a while since I wrote something here but I’ve been busy writing something else. I’m proud to announce the availability of the book I have been written for the past few months: Pro Telerik ASP.NET and Silverlight Controls.

This book provides a complete guide to implementing Telerik’s range
of ASP.NET and Silverlight controls. Telerik controls are invaluable for
ASP.NET and Silverlight developers because they provide a vast array of
rich controls targeted for the presentation layer of web applications.
Telerik offers you solutions for the reports, grids, charts, and
text-editing controls that you need but don’t want to build from scratch
yourself—the options are endless for increasing the functionality of
any of your web solutions.

What you’ll learn

  • Understand
    how to integrate the standard Telerik controls into any ASP.NET or
    Silverlight solution to increase productivity and usability.
  • Incorporate
    the Telerik extensions for ASP.NET MVC.
  • Learn to implement
    Telerik Open Access and ORM for all your data access requirements.
  • Work with the full API to master using the entire
    suite of controls.

Who this book is for

This
book is aimed at .NET developers working with ASP.NET and Silverlight
who want to take advantage of the prewritten controls that Telerik
provides when developing their software. No prior knowledge of Telerik
controls is required, but a working knowledge of ASP.NET and Silverlight
is assumed.

Table of Contents

Chapter 1:Introducing
ASP.NET and Telerik
Chapter 2: Getting Started With Telerik
RadControls
Chapter 3: Input RadControls
Chapter 4: Navigation
RadControls
Chapter 5: Date, Time, and Scheduling RadControls

Chapter 6: Data RadControls, Part 1
Chapter 7: Data RadControls,
Part 2
Chapter 8: Layout RadControls
Chapter 9: Chart and Image
RadControls
Chapter 10: Additional RadControls
Chapter 11:
RadAjax
Chapter 12: Telerik Extensions for ASP.NET MVC
Chapter
13: RadControls for Silverlight
Chapter 14: Introducing Telerik
Reporting
Chapter 15: Telerik OpenAccess ORM

Twitter contest thanks to Apress

 

Hi all.

Thanks to the wonderful people of Apress I have 5 coupons worth each for a free copy of the ebook:

 

If you want one just need you to do 3 simple tasks:

  1. Follow me on Twitter: @jrguay (this is mandatory because I will DM you the code if you are selected as winner)
  2. Tweet: “@Apress books rock because…” (complete the phrase with your thoughts).
  3. Include in your tweet the tag #APRESSGUAY so I can look for the tweets later.

The rules are simple, I will randomly select the winners on Tuesday 29th at 12PM (CST) and will DM the winners the respective code. You can use the code to purchase the ebook in the Apress website and you’ll get a 100% discount.

[UPDATE]: The winners of the contest are: @gersonmayen, @ddurose, @rgreen, @EdvL & @gromer. Thank you!

Stay tune for more contests to come.

Enjoy!

The ASP.NET Capsule #24: Examine Output Compression

Hi all.

After an interesting discussion with Cristian Prieto (ASP.NET MVP) he pointed me in the right direction of a problem I was having.

The issue was with a web application I recently published to IIS. A new page I added was throwing an exception but instead of showing the error as I would expect, it was throwing a lot of garbage:

image

Now, the problem was that I didn’t have a way to find what the real problem was until he said that the output was probably being compressed, so after following his advice I checked with Firebug and the results were:

compressed_output

If you see the header Content-Encoding the value is gzip. That was a clear indicator of the output being compressed.

I checked the IIS7 settings and compression was not enabled, so I checked the Global.asax file and this is what I found:

   1: protected void Application_BeginRequest(object sender, EventArgs e)

   2: {

   3:     if (Request.RawUrl.Contains(".aspx") && (Request.Headers["Accept-Encoding"] != null))

   4:     {

   5:         if (Request.Headers["Accept-Encoding"].ToLower().Contains("gzip"))

   6:         {

   7:             Response.Filter = new System.IO.Compression.GZipStream(Response.Filter, CompressionMode.Compress, true);

   8:             Response.AppendHeader("Content-Encoding", "gzip");

   9:         }

  10:     }

  11: }

After a couple of small refactorings thanks to ReSharper:

   1: protected void Application_BeginRequest(object sender, EventArgs e)

   2: {

   3:     if (!Request.RawUrl.Contains(".aspx") || (Request.Headers["Accept-Encoding"] == null)) return;

   4:     if (!Request.Headers["Accept-Encoding"].ToLower().Contains("gzip")) return;

   5:     Response.Filter = new System.IO.Compression.GZipStream(Response.Filter, CompressionMode.Compress, true);

   6:     Response.AppendHeader("Content-Encoding", "gzip");

   7: }

I was now able to disable output compression and see what the issue was. After solving the problem I enabled it again and things work as expected.

Checkout Cristian’s blog post about output compression (in Spanish).

Enjoy!


News: New Free Tools from Telerik

image

TFS Work Item Manager & TFS Project Dashboard in a Nutshell

These two free applications have been designed to make working with Microsoft’s Team Foundation Server faster and easier. By promoting robust yet flexible project management practices, TFS Work Item Manager Beta and TFS Project Dashboard Beta allow for rapid delivery of high-quality software. Both applications have been built by Imaginet Resources using RadControls for WPF and are available for free download.

How Does TFS Work Item Manager Add Greater Value?

If you are using Visual Studio Team Foundation Server to manage your work items, you’ll simply love this tool! TFS Work Item Manager provides a unified platform to support those of you who want to take advantage of the Team Foundation Server without the need to switch from MS Team Explorer to MS Excel, to MS Project to find a certain work item. Its seamless integration with TFS allows you to add and edit work items, or save queries in real-time, along with the advantage of better work item visualization and improved team collaboration. The TFS Work Item Manager helps free up more developer time to actually write code, not manage what development teams have to do.

Read more.


Video: Webcast JetBrains ReSharper en Español

Hola a todos.

El día 31 de Agosto tuvimos un webcast sobre JetBrains ReSharper. Acá está el video para quienes no pudieron asistir.

Adjunto también la presentación de PowerPoint debido a que por un problema técnico no se visualiza.

Descargar la presentación aquí y el video aquí.

Felicitaciones a Jorge Albergo Gamba Porras de Colombia por haberse sido el afortunado ganador de la licencia personal de ReSharper.

Saludos.


News: JetBrains YouTRACK (Formerly ‘Charisma’) Enters Beta Phase

YouTrack (previously code-named Charisma) is a keyboard-centric bug and issue tracker web application. Whatever you do with your issues, you can do it much faster because most of your actions involve two simple controls:

  • Search for issues by typing queries in the search box using query completion. Read more »
    Search for issues using YouTrack search box 

 

  • Modify multiple issues at once using the Command window. Read more »
    Apply any commands to selected issues 

 

  • Commands syntax is similar to that of YouTrack search queries, so you can get started in no time!

YouTrack offers even more ways to minimize the time you spend on reporting and/or processing issues:

  • Create new issues by simply pressing Alt+Ins from anywhere within YouTrack. Read more »
  • Use extensive keyboard support to create, edit, and navigate between issues — all major actions have easy-to-learn shortcuts. For example, to close an issue, you type fixed, and press Ctrl+Enter. Read more »
  • Assign tags to group issues the way you like, regardless of their attributes. For example, you can create a tag like fix it today and associate it with issues from different projects, subsystems, etc. Read more »

YouTrack is distributed as either a JAR or a WAR file, ready to run as a standalone Java process or to be deployed at any of today’s popular application servers, including Apache Tomcat 5+, Apache Geronimo, Mortbay Jetty, Caucho Resin, and JBoss.

YouTrack is being developed with JetBrains MPS and is used to track issues in our own products, including TeamCity, dotTrace, MPS, and Web IDE.


News: JetBrains new product “Charisma” now in Early Access Program

Hi all.

The JetBrains team have created a new product codename “Charisma”.

What is Charisma?

Charisma is a web-based issue tracker. Charisma’s key features include:

  • Query-based issue search as an alternative to traditional issue filters.
  • Lightweight AJAX-based user interface to allow working with issues really fast.
  • Extensive keyboard support to make it easy to create, edit, and navigate between issues using keyboard.
  • Commands to quickly execute batch operations upon selected queries.

Charisma is being developed using JetBrains MPS and is used for tracking JetBrains TeamCity issues.

Supported Browsers

  • Mozilla Firefox 3+
  • Apple Safari 3+
  • Microsoft Internet Explorer 7+
  • Google Chrome 1+
  • Opera 9+

Where to Send Feedback?

Would you like to try it? Just click here to get access to the EAP version.

Enjoy!

The ASP.NET Capsule #23: Telerik RadControls for Silverlight 3

Hi all.

The guys from Telerik are very busy this days. Now they have just launched SP1 of their RadControls for Silverlight Q2 2009 with Silverlight 3 Support.

Acording to Hristo Maradjiev the service pack not only includes the official supported controls for Silverlight 3, but also a bunch of bug fixes and enhancements. The bad news is that Telerik will discontinue the future support for the Silverlight 2 controls. The dlls for SL2 will still be included in this release, but not in the installation files and the demos. 

But that’s not the end of the story, The RadControls for Silverlight 3 also supports .NET RIA Services:

You’ll get:

  • Completely codeless binding to .NET RIA Services
  • Simple access to server-side data
  • Impressive validation support on the client and on the server
  • Patterns for dealing with common Line of Business scenarios
  • Automatic data paging by using the pager control
  • Easy re-use the ASP.NET authorization and authentication
  • Faster server-side sorting, filtering and paging for all data

So I hope you can take advantage of this important milestone in RadControls for Silverlight. Here are some links:

Enjoy!

The ASP.NET Capsule #22: Official Support for ASP.NET MVC by DevExpress

Hi all.

So, the guys from Developer Express can’t be far behind, actually today they also announced officially the support for ASP.NET MVC in a blog post by Mehul Harry (DevExpress Technical Evangelist).

The post also announces the inmediate availability of a FREE demo application with source code included called DevExpress Mail Demo.

The post states the following regarding the demo application:

The MVC Mail demo is an online mail application similar in basic features to gmail.com or mail.com. So have fun playing around with it. And don’t worry about breaking the database because there isn’t one. Instead, this demo uses session state to persist the tiny amount of data. This allows you to tweak and bend the demo without us having to reset some database.

Check out the sample here: http://mvc.devexpress.com

Stay tuned for more on DevExpress and ASP.NET MVC. They are catching up and comming very strong.

Enjoy!