|
 |
|
The Reluctant DBA |
 |
|
 |
| |
| Author: | CarpDeus | Created: | 4/18/2008 6:56 AM |  | | As a programmer and database administrator, I've seen a lot and here I'll record bits of information about what I'm doing and how I'm overcoming various challenges |
By CarpDeus on 6/29/2009 10:30 AM
I know I've put a lot of Azure information in this blog and more people expect it to be geared more toward SQL Server and C#. So I've created a new website, AzureDBA.com, to host all of my Cloud Computing information; including, but not limited to: - Best Practices
- Codes Samples
- Forums for discussions
Stop by and join the discussion of what will be an important part of the next step in computer programming. Josef
| By CarpDeus on 6/18/2009 7:27 AM
In my last post, A REST-ful Look at Azure (Part 8) Azure Hosted Services, I took a very brief look at the Web Role and a more in-depth look at the Worker Role. Today I'm going to explore some things you should do when implementing a Worker Role.
As I said in my last post, the Worker Role should be an extremely light wrapper that calls a class that does all of the real work. There are two good reasons for this. First, the less code in the Worker Role, the less debugging you need to do in the Development Fabric, the easier it will be to write, test and debug your code. Second, the code in the Worker Role should be fairly stable. If all it is doing is instantiating a class and calling it every few seconds, it lessens the chances of errors happening in the Cloud version that will require major changes. Follow the basic rule of Keep It Super Simple when it comes to your Worker Role.
The class that the Worker Role is instantiating should include a call back function (see my blog post Services, Worker Classes and Templates, Oh My from February 23, 2009 for more details) that serves two purposes. First, it allows the Worker Role to log information to the Cloud Logs but it also updates the DateTime value the Worker Role uses to determine it's not hung. Finally, it should also include a way for the Worker Role to notify it that a request has been made to stop processing.
My generic Processing Class simply queries Azure Queue Storage to see if there is a message to be processed. There may be more than one, but the Processing Class gets just one and processes it. When it has finished, it checks to see whether or not the boolean value stopProcessing is true. If it isn't, then it checks the queue for another message and starts the process all over again.
While this is the best solution we have at the moment, it's not the optimal one and will have to change as Azure Hosted Services comes out of the CTP stage and enters Beta or Release. A couple of items this doesn't address:
How responsive must a Worker Role be?If a Windows Service doesn't respond to a shutdown request in 30 seconds, it's considered "frozen" and Windows will instantly terminate the thread. It's unknown what the Worker Role will do or how long it will wait. It will probably be a requirement to handle a graceful shutdown that every time you call Notification you also check to see if you should stop processing. Continuation of processing.If the Worker Role ends in the middle of a request, how do you gracefully continue? How Idempotent is your processing? In this particular example, if the request isn't in Pending status, the worker role just says it is in error and doesn't do anything. Code Samples The complete sample code can be downloaded here.
First, we have the basic plumbing that handles sending notifications back to whatever is calling the class:
... Read More » | By CarpDeus on 6/17/2009 8:36 AM
You may disagree with the title of the post, but I think it is far more true than not. First, because I know folks are going to try to tell me, this doesn't apply if you're using S[S]DS (SQL Server Data Services), once it finally becomes available because it really is nothing more than SQL Server running on MS machines in the cloud. This is, of course, the same as if you were running SQL Server on Amazon hardware. But there's a major problem with SQL Server when it comes to scalability above a certain level, most of which I covered in Why Aaron Skonnard is Wrong About Azure Table Storage. And all of the things that make SQL Server bad for highly scalable web sites are the things we know as DBAs.
For instance, if you've ever heard Kimberly Tripp speak about database design, you've... Read More » | By CarpDeus on 6/11/2009 7:42 AM
Windows Azure isn't just about Azure Storage Services, it's also about running hosted programs in the sky. And this is actually a critical part of Azure Storage Services, even though it may not seem like it. The series so far has introduced Azure Storage Services and talked about what you can do with each of the pieces, but the time has come to take it to the next level, which includes taking care of some of the management issues that SQL Server and other RDBMSs do for us.
Now, I have said that one of the reasons that Azure Table Storage scales better than SQL Server is because it is simpler and doesn't have all the overhead of managing the data that SQL Server does. And you might accuse me of reinventing the wheel. But there are certain pieces of data management that make sense. Take what SQL Server does when we ask it to process something like this:
... Read More » | By CarpDeus on 6/10/2009 6:28 PM
Update: Aaron responded to my post (please see comments below) so I've made a minor edit to the post. At this morning's first Azure talk at VSLive Las Vegas, I thought I heard Aaron Skonnard state that Azure Table Storage was irrelevant, to be replaced by SQL Data Services (his views are in the comments) . I have to say, that probably didn't really help with attendance at my after lunch talk on ATS, but it did get me thinking even more about why ATS is important and why SQL Server has scalability issues. Let me state, first and for the record, Read More » | By CarpDeus on 6/9/2009 4:01 PM
So, I'm testing something with Azure Table Storage and notice that the data I get back is not the data I thought I sent. So I stepped through my class carefully. What I sent to MS to store in my table was: Read More » | By CarpDeus on 6/9/2009 10:18 AM
Creating and Retrieving Blobs with BlocksIf you want to upload a large file to Azure Blob Storage (ABS), you're going to need to split it into pieces and transmit the individual pieces. Then, when you get them all uploaded, you tell the server to assemble them. This is all done using Blocks, which may be up to 4MB in size. It sounds complicated, but it isn't really. The first thing you do is split the file into 4MB blocks. If you have a Byte Array, this is easy enough to do. Then, you upload each block to the server using PUT and the URI of http://{account}.blob.corewindows.net/{Container}/{Blob}?comp=block&blockid={blockid} (CanonicalURL is Read More » | By CarpDeus on 6/8/2009 4:27 PM
So far, this series has covered an Introduction to Microsoft Azure, the way that Azure Storage handles Security, an Introduction to Azure Table Storage, more on Azure Table Storage and Azure Queue Storage. Today I venture into Azure Blob Storage. If you want to follow along, download a copy of my AzureCommand class. You also might want to create an Microsoft Azure Account. I should state that I am not looking at the locally hosted development storage, only at the cloud hosted one.
When we talk about BLOBs, we are talking about Binary Large Objects, not an amoeba like alien that terrorized Downington, PA (although it appears that a blob is a blob and not really a BLOb). And BLOBs generally can be thought of as files. These files exist in...
Containers
Containers in Azure Blob Storage (ABS)
... Read More » | By CarpDeus on 6/4/2009 9:14 AM
So far I've covered an Introduction to Microsoft Azure, the way that Azure Storage handles Security , an Introduction to Azure Table Storage, and Azure Queue Storage. Today I'm going to look deeper at some aspects of Azure Table storage that didn't make it into the introductory post. If you want to follow along, download a copy of my AzureCommand class. You also might want to create an Microsoft Azure Account and load in some data. If you're looking for some data to play with, load a copy of test data. I should state that I am not looking at the locally hosted development storage, only at the cloud hosted one.
eTags
HTTP Etags are
... Read More » | By CarpDeus on 6/3/2009 8:08 AM
When one thinks Queues, one may conjure up many different images. Microsoft has MMQ and has implemented Service Broker, both as means of having stateless communication. Azure Queue Storage (AQS) is similar. The stated reason for using AQS is to be able to kick off Azure Worker Roles, but you can actually use AQS for any type of stateless communication. AQS consists of two parts: Queues and Messages. Queues, like Tables in ATS, are really nothing more than defined URIs that can be used to store and retrieve messages.Messages are nothing more than text packets (up to 8KB) that can be stored and retrieved from a specific URI. So, let's dig in.
Queues
Queues in AQS, are
... Read More » |
|
|
| |
|
|
|
|
|