I was on Twitter and suddenly some remember that it would be interesting to write some Best Practices about using Windows Azure. Here are some of the ones I remembered:
- Get out of the way when you can. Send client directly to blob storage for static content
- Use Shared Access Signatures to provide direct access to ACLed content. Can be time-bound and revoked on demand. Also important will be using a Shared Access Policy in order to remove information like end date from url
- Serve public blobs from the edge with the Windows Azure CDN. You have fewer hops, and be closer to the customer.
- If you’re using #CDN don’t forget to Manage the Content Expiration. The Default is 72 hours
- If you’re using CDN use versioned urls to allow immediate refresh. Really important to avoid caching problems
- Cache hot data in memory to avoid slower data-tier access. Ex. Session State, immutable reference data. Using the Caching ties will help you reduce latency and in some cases also costs
- Consider using more smaller compute instances instead of few large one. Most times you’ll get better performance
- Partition Data based on the indexing needs. Use #SQLAzure for highly indexed data, and #Storage for the rest. Really consider doing Hybrid Partitioning
- Shard your #SQLAzure data across databases to increase the workload.
- Don’t forget to do the basic performance tuning to applications. Measure, optimize & create a baseline for performance
- Don’t forget to enable compression for additional dynamic content types in Web Apps
- You can’t update Apps with a different number of endpoints, so prepare for that upfront, leave some backdoors opened
- In #Azure #AppFabric Caching Prefer to cache more smaller objects then few larger ones, increases your performance
- Consider VMRole only when you need something installed that takes long time or is a non-automated install
- Use Startup Tasks preferably in background unless you need a specific order in their launch
- Use Asynchronous Work Pattern and Queues instead of using a Synchronous approach on your Roles
- For devices don’t connect directly to #SQLAzure, proxy those in your #Azure Compute (of course #SOA approach)
- If you use Startup Tasks don’t forget to log everything. Ex. command >> %~dp0log.txt 2>> %~dp0err.txt
- Don’t forget to use “/y” in everything to avoid confirmation messages. Ex. “copy /y source destination”
- For Startup Tasks use local storage since it’s a guaranteed space, and if there’s not enough space it won’t run.
- If you need to run a startup task that needs the IIS pool to exist, then you should use OnStart() in elevated Role – This isn’t a problem since running a Role in Elevated mode doesn’t affect how the Web Application will run on IIS
- Process that needs to be monitored you should use a ProgramEntryPoint or NetFxEntryPoint instead of Startup Tasks
- Define NetworkTrafficRules in order to better protected internal access to your roles
- If you’re using Traffic Manager build a AppHealth page Monitor that checks if everything is OK in your Application
- When using Table Storage use the SaveChangesOptions.Batch to improve performance and save transactions
- Choosing your VMSize is important, choose accordingly to your Speed, Memory, IO and Network needs.
- Use Retry Logic for #SQLAzure connection and for #AppFabric Service Bus, Cache and Storage. Use Transient Fault Handling Framework for SQL Azure, Windows Azure Storage, Windows Azure AppFabric Service Bus and Cache.
- Don’t use owner for #AppFabric Service Bus. Create your own login and provide them the appropriate permissions. Check this post by Neil Mackenzie.
- Don’t use the #SQLAzure login that you created on the Management Portal in the connection String. Create your own. This is because you need to work in the least privileges and you don’t want to use the SA for that.
- When using Queues instead of using GetMessage use GetMessages(count), this will help you save transactions and improve performance of your solution
- If you’re using Workers that are Queue based (Pooling Mechanism), use a back off mechanism when no messages are found in the queue. This will help reduce the number of transactions that are done and improve your solution performance
- If you’re using Workers that are Queue based (Pooling Mechanism), you should consider using notifications to resume the back off mechanism. #AppFabric Service Bus will be perfect for this, but don’t forget to do the cost calculation to your scenario.
- Perform your Application Scaling process considering all options, Scale Up, Out and Down, don’t forget Down.
Last Updated 2011-10-21.