Enhance the Diagnosability of your Apps with Windows Azure

Hosted Software, Windows Azure No Comments »

Windows Azure logo bl In the last few posts, we have been discussing how running your application in Windows Azure allows you, with minimal incremental code, to cloud-enhance your application with capabilities such as elasticity, automation, and diagnostics.

My colleague, Sumit Mehrotra, dives into the diagnostics capabilities on his blog – describing how Windows Azure offers rich centralized diagnostic capabilities without making you change how your application does its logging (e.g. System.Diagnostics.Trace, IIS logs, application crash dumps, etc.).

Run and Enhance Client-Server Apps with Windows Azure

Hosted Software, Windows Azure 1 Comment »

In the previous post, we discussed that you can not only run some of your favorite technologies in Windows Azure but that you can easily cloud-enhance them with capabilities such as automation, elasticity, and diagnostics.

My recent post on the official Windows Azure blog introduces an example, describing how to run a client-server application (e.g. a relational database or distributed memory cache) in Windows Azure and then add elasticity to the server tier. Elasticity allows you to minimize your costs by dynamically adjusting capacity to meet demand. Let’s dig a bit deeper, diving into what the corresponding code would look like:

Service Definition

To get started, we need to define the server tier and declare an internal endpoint.

<WorkerRole name="MyServer" enableNativeCodeExecution="true">
  <Endpoints>
    <!-- Defines an internal endpoint for inter-role communication that can be used to communicate between worker or Web role instances -->
    <InternalEndpoint name="MyEndpoint" protocol="tcp" />
  </Endpoints>
</WorkerRole>

Client Code

Note that only three lines of Windows Azure specific code, highlighted below, are needed to a) initialize the client and b) reinitialize the client when server instances are added or removed.

private MyClient InitializeClient() {
    var client = new MyClient();
    foreach (var inst in RoleEnvironment.Roles["MyServer"].Instances) {
        client.Add(inst.Id, inst.InstanceEndpoints["MyEndpoint"]);
    }
    return client;
}

public void Go() {
    // Initialize the client
    var client = InitializeClient();

    // Reinitialize the client when there is a topology change
    RoleEnvironment.Changed += (sender, args) => {
        if (args.Changes.Any(chg => chg is RoleEnvironmentTopologyChange)) {
            client = InitializeClient();
        }
    };

    // Use the client as you would outside Windows Azure…
}

Server Code

Finally, we add one incremental line of code on the server tier, highlighted below, to discover the IP address and port to bind to.

// Discover the IP address and port assigned by Windows Azure
var ep = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["MyEndpoint"];

// Start the listener -- in this case another process -- passing in this info
var startInfo = new ProcessStartInfo
{
    FileName = @".\MyServer.exe",
    Arguments = "-l " + ep.Address + " -p " + ep.Port,
    UseShellExecute = false,
    CreateNoWindow = true
};
Process.Start(startInfo);

My PDC09 Talk, and Takeaways about Cloud-Enhancing Your Apps

Hosted Software, Windows Azure 2 Comments »

Windows Azure Logo I, along with Tushar Shanbhag, recently gave a talk @ PDC09 on using PHP, memcached, and MySQL to build applications with Windows Azure. The video and slides are now available.  We used the technologies in the talk to reinforce some key Windows Azure benefits, specifically how to:

  1. Easily get started with these (PHP and memcached/MySQL) and a variety of Windows Server-compatible technologies on Windows Azure.
  2. Maintain, scale, and more broadly cloud-enhance these technologies by leveraging platform primitives in Windows Azure.

Ray Ozzie, Microsoft’s Chief Software Architect, talked to similar points at a recent Financial Analyst and Investor Briefing this past Wednesday:

The way that we kind of think about it is, most people will do a move, extend, and then transform. They’ll move something to the cloud, then they’ll start to mess around with it, and understand what it’s like to be in the cloud. And then they’ll extend it by starting to take some aspect of it and take advantage of the cloud.

Having served as CTO of a startup where we leased our own rack and burned lots of time on both software- and hardware-related “I.T. stuff”, I get especially excited about the extend/cloud-enhance point. In addition, it reinforces that Windows Azure is much more than a hosting provider.

Here are just some of the ways you can cloud-enhance your applications with Windows Azure with minimal incremental code:

  1. Elasticity (Even for Client-Server Apps): As we demonstrated in our talk, you can continue to use client-server apps (i.e. memcached) as you do today. However, by leveraging Windows Azure’s new topology discovery API’s, you can add elasticity with just a few lines of code to automatically update your clients’ connection tables when server nodes are added or removed.
  2. Diagnostics: You continue to log and trace as you do today. However, with Windows Azure Diagnostics, you can choose to direct the output (from potentially multiple nodes) to a centralized location in Windows Azure Tables. By doing so, you get a durable and queryable way to detect & troubleshoot problems, measure performance, etc.
  3. Automation: You continue to use the configuration mechanisms (e.g. .ini file) you use today. However, by writing incremental code, you can have the ini file populated from a Windows Azure configuration setting. In doing so, this configuration, which could be living on 1000s of your nodes, is now updateable via a single change in the Windows Azure management portal.

Same Blog (Mostly), a New Name, and SEO

Hosted Software, Windows Azure 2 Comments »

Rebranding from This Hosted Life to Cloud MouthAs you may have noticed, I have rebranded this blog from This Hosted Life to Cloud Mouth. A few weekends ago, I decided I would like to start blogging again and with a greater emphasis on Windows Azure, the cloud services platform I am working on at Microsoft. So, I went to GoDaddy’s domain name search and decided not to get up until I found a domain name I liked. I sort of knew I wanted “cloud” in the name, and it eventually hit me that I could play off the fact that “cloud” rhymes with “loud”. Unfortunately, cloudmouth.com was unavailable. But, I was okay with a .net domain name instead, and thankfully cloudmouth.net was available!

SEO Implications

Having been through a rebranding before, I knew one of the most important next steps was to make sure every inbound link to the old site is 301 redirected to the new site. With this type of redirect, search engines (in theory at least) know to automatically transfer page rank from the old url (e.g. http://thishostedlife.com/about) to the new url (e.g. http://www.cloudmouth.net/about). This is not always the case with other forms of redirection.

You can do this with IIS or Windows Azure with the following set of rewrite rules that tell the Web server to 301 redirect all requests for anything other than http://www.cloudmouth.net/… to http://www.cloudmouth.net/….

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="(.*)" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="" ignoreCase="false" />
        <add input="{HTTP_HOST}" negate="true" pattern="^www\.cloudmouth\.net" ignoreCase="false" />
      </conditions>
      <action type="Redirect" url="http://www.cloudmouth.net/{R:1}" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>

If you aleady have an equivalent set of rules for Apache, such as the ones below, these can be easily converted by Microsoft’s IIS Manager for consumption by IIS or Windows Azure.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.cloudmouth\.net
RewriteRule (.*) http://www.cloudmouth.net/$1 [R=301,L]
</IfModule>

Finally, you can use a tool such as Web-Sniffer, one of my favorites, to confirm all your old pages return HTTP Status Code: 301 Moved Permanently and that your hard-earned page rank will be (hopefully!) retained.

Optimizing Web Sites for Search Traffic

Hosted Software No Comments »

I recently gave the following talk to the Chinese Institute of Engineers on the Microsoft campus.  The talk is an introduction to Search Engine Marketing (SEM), focusing on Search Advertising and Search Engine Optimization. I also explain the search business model and ranking algorithm to the extent that is needed to effectively implement SEM.

Much of the detail comes from my experience at Faves.com, where we were able to achieve over one million visits originating via organic search each month.

As a side note, the audience was great — asking lots of questions and validating the broad applicability of SEM to a variety of businesses.  Enjoy!

What Makes a Good Web Development Framework?

Hosted Software, Project Management No Comments »

I recently started using Blueprint, a CSS framework “which aims to cut down on your CSS development time”, for a Web development project. I have found I can whip up a nicely laid out site that works across all browsers *much* faster with Blueprint than I could without it. As a result, I spend more time on creating business value and less time dealing with the many obscure bugs in Internet Explorer 6.

Having said that, I’ve had the opposite experience with other frameworks. This got me thinking, “What makes a good framework?”

Note: In the below examples, I compare Blueprint with Microsoft’s ASP.Net. Admittedly, this is sort of an apples-to-oranges comparison: ASP.Net is for server-side Web development whereas Blueprint is for client-side Web development. Nonetheless, they are two frameworks I am actively using and hence enable me to give personal examples.

Note 2: Even though I seem to suggest otherwise below, much of ASP.Net is great. In fact, we use it to power
Faves.com. We just stay away from the parts of the framework that violate the following criteria.

With that out of the way, I think a good framework is one that ultimately saves time and/or cuts costs in meeting business objectives because it

  • Avoids reinventing the wheel: This is arguably *the* point of choosing a framework instead of coding something directly. For example, the Blueprint framework gives me the following that I would otherwise have to create myself:
    • An easily customizable grid
    • Sensible typography
    • Relative font-sizes everywhere
    • A typographic baseline
    • Perfected CSS reset
    • A stylesheet for printing

  • Still lets me do things the “raw” way: All frameworks have their limitations, and I often have to revert to doing something outside the framework. When using Blueprint on a page, I can still mix in my own non-Blueprint CSS styling and layout. On the other hand, if I want to use some of my favorite ASP.Net controls on a page, I am forced to adopt the ASP.Net Web Forms model and its associated evils for the entire page.

  • Takes less time to learn than how much it will ultimately save: Blueprint *is* a subset of XHTML and CSS. ASP.Net, in an effort to make things easy for the novice user, actually makes me understand a completely different model. Ironically, this can make things more difficult for the seasoned developer.

  • Creates consistency across the team: Implicit in using Blueprint is a set of naming conventions. This makes it much easier for a team of developers (or if using a Blueprint with a CMS, the content creators) to specify and read each others’ layouts.

  • Follows best practices: The framework should deliver as is “generally expected”. For example, there are a number of SEO best practices for having your site properly indexed by search engines. But, ASP.Net violates a number of these, including this one. I need to find creative ways to work around each violation, costing me time and money. Ideally, best practices compliance is just included.

  • Lets me view the source code: There are times I need to know what exactly the framework is doing in order to diagnose or prevent bugs.

  • Is high performance: Slow performance is an issue if it *meaningfully* degrades the customer experience or *meaningfully* increases server and support costs as compared to how much time and money I am saving by using the framework.

On Packaging: WordPress vs. Drupal

Hosted Software 5 Comments »

In the past month or so, I’ve spent some time with two content management systems: Drupal and WordPress. Both products make it easy to build and edit relatively sophisticated Web sites from within the browser.

However, only WordPress gave me that “Aha! moment” you get when a product so seamlessly fits your functional needs and is fun-to-use at the same time. In fairness to Drupal, this is not particuarly surprising since:

  • WordPress is designed for a more specific scenario. In WordPress, you have Blog Posts and Pages. In Drupal, you have a very abstract concept of a Node. While an instance of a Node can be a Blog Post or a Page, it can also be many other things.
  • WordPress comes pre-packaged with the plugins that meet this scenario. While both products have a robust plugin architecture, WordPress is good to go out-of-the-box whereas Drupal requires you to install modules (once you figure out what they are) to have a system comparable to WordPress.

Anyways, the takeaway should *not* be that Drupal sucks. On the contrary, it powers some of the largest sites on the Web, including FastCompany.com. The takeaway here is that there is an opportunity to turn Drupal’s “weakness” into a strength, by leveraging the generic architecture and wide availability of plugins to create Drupal distributions for specific customer scenarios and segments.

One such customer segment is non-profit and volunteer organizations. As an example, I am a fan of Seattle Works‘ Web site. The event planning features of the site are arguably what make the organization so active. For another time, I’d like to see a) if there already is a hosted Drupal distribution that serves this segment as *well* as the Seattle Works site does for its members and b) if not, what it would take to create one.

Microblogging with Twitter & Faves

Hosted Software No Comments »

I have included widgets from two “microblogging” services, Faves.com and Twitter, in the sidebar of this blog. Not surprisingly, I use these microblogging services to broadcast “stream of consciousness” thoughts whereas I plan to use this blog for hopefully more thought provoking and “on-topic” posts.

But, why *two* microblogging services?

  • I use Twitter to broadcast what I am doing and to watch what others are doing.  It simply helps me be “in the know”.  The no-frills format of a Tweet on Twitter, specifically the 140-character limit and SMS compatibility, is ideal.
  • I use Faves.com to share items such as news articles, videos, and recipes that will be beneficial (educational or entertaining) to others and myself.  The automatically generated tags and thumbnail in a Fave, combined with the rich permission system, make Faves.com ideal for this scenario.

Openads – A Real Life Example, Part 1

Hosted Software No Comments »

I recently setup Openads for Faves.com. Openads is a powerful ad server that lets your manage how ads are delivered on your site. It is similar to Google’s Doubleclick except that a) Openads is free and b) you can host it yourself.

You begin by telling Openads about your inventory. This is done by defining zones and then assigning the appropriate advertising campaigns to these zones. You then customize delivery (i.e. with what frequency or under what conditions a specific campaign for a zone is shown) by defining delivery rules.

While the documentation is reasonably good, I had trouble getting my head around the terminology without a real-life example. So, I am including our configuration, slightly simplified and modified, over my next few posts. Enjoy!

For this post, here is how Openads terminology maps to our scenario:

  • Advertiser: Google
    • Campaign: AdSense
      • Banner: 468×60
      • Banner: 728×90
  • Advertiser: Amazon
    • Campaign: Omakase
      • Banner: 468×60
      • Banner: 728×90
  • Advertiser: AcmeMediaGroup
    • Campaign: FunnyWigs.Com (Direct Ad Sale)
      • Banner: 468×60
      • Banner: 728×90
  • Publisher: Faves.com
    • Zone: 468×60 – Top
    • Zone: 728×90 – Top
    • Channel: shopping - Allows the publisher to request ads specifically targeted to shopping inventory.
    • Channel: nonshopping

In my next post, I will talk about delivery rules. These tell Openads when to show each of your banners.

Design by j david macor.com.Original WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in