THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Jamie Thomson

This is the blog of Jamie Thomson, a data mangler in London working for Dunnhumby

Tweetpoll and RESTful Northwind go bye-bye

On 31st January 2010 Windows Azure and SQL Azure will transition to becoming services that you have to pay for which means that my three small demos that are hosted up there are going to disappear hence I thought now would be a good time to review before they are digitally ground into dust.


Tweetpoll was a demo that I wrote back in April 2009 and is hosted on Windows Azure at Here’s what it does:

  • periodically polls Twitter’s public timeline and gets returned a list of the latest tweets
  • pushes each returned tweet onto a Windows Azure queue as a message
  • picks each message off the queue, measures the length of the tweet, and increments a counter (in Windows Azure table store) for each length
  • Displays the distribution of tweet lengths on a graph at (using some questionable HTML and Javascript :)
  • Counts the number of hits on and maintains that count in Windows Azure table storage too
  • Displays the current contents of the Windows Azure queue

Here’s a diagram that shows that a little better and demonstrates which parts use Azure web and worker roles. It was built at a time when one could only have one worker role per application therefore two threads are used to simulate the pushing onto and picking off the queue:

tweetpoll architecture

Its a very noddy application and the use of a queue is gratuitous but nevertheless its a useful demo of what can be achieved and enabled me to get some experience of building an app on Azure. The source code is available at

I wrote a blog entry back in May 2009 called Tweetpoll – My first Windows Azure application is live that introduced Tweetpoll. In that blog entry I provided a screenshot of the graph that gets displayed at and here it is again:

tweet length distribution May 2009

Here’s what it looked like in July 2009:

tweet length distribution July 2009

And finally today in January 2010:

tweet length distribution January 2010

I said at the time that it would “be interesting to see if the graph smoothes out over time” and sure enough that is what has happened. We still get a massive spike around 140 characters of course but its clear to see that the curve has smoothed out before that spike. I also find it interesting that there are more tweets in the 30-50 range than 90-120; something for academics to ponder over perhaps. Finally, if you are wondering why some tweets appear to be over 140 characters in length then take a read of my blog entry The Longest Tweet where I explain why that is.

Incidentally, by adding up the counter for each tweet length I can determine how many messages Tweetpoll has gotten off of the public timeline since April 2009 and I display that number at too:

tweetpoll total tweets polled

Last but not least here’s how many hits the site has had:

tweetpoll page hits

Again, if you’re interested in looking under the bonnet of Tweetpoll then the source code is available at

RESTful Northwind

When SQL Azure entered public beta I wanted to build an app that would demonstrate its capabilities so I built Its is, quite simply, a copy of the venerable Northwind database hosted on SQL Azure with a WCF Data Services (née Astoria) head on top of it which is hosted on Windows Azure. If you hit the WCF Data Services head then this is what you see (make sure you have feed reading turned on in your browser):

restful northwind head

Some sample queries that you can issue:

All the code is available on Codeplex at

If you want to read more about RESTful Northwind then go read my blog entry RESTful Northwind on SQL Azure where I also talk a little about how I attempted to use datadude (aka Visual Studio Team System for DB Pros aka whatever-its-called-today) against SQL Azure.


This one is a lot simpler than Tweetpoll or RESTful Northwind, it is simply a SQL database hosted up on SQL Azure. In December 2009 Brent Ozar blogged about how he had been archiving tweets from various people that he follows into a SQL Server database and he made a backup of that database available for anyone that wanted to use it. I thought it would be cool to host that database up on SQL Azure both because it would demonstrate SQL Azure’s abilities and because it would save anyone else having to go through the rigmarole of restoring it themselves so I copied the schema up there and pumped the data in using SSIS.

Read more (including instructions on how to access it before it disappears) at TwitterCache now hosted on SQL Azure.

These apps/services will be disappearing in about one week from now so if you’re interested in using them go and do it now. Remember, the code for Tweetpoll and RESTful Northwind is up on Codeplex at:

Hope these have been useful to someone, they certainly have been for me!


Published Saturday, January 23, 2010 11:25 AM by jamiet

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS


No Comments

Leave a Comment


This Blog


Privacy Statement