Saturday, 7 June 2008

Twitter and Second Friends

Twitter is mildly borked right now which has interrupted the flow of tweet bubbles from my Second Friends Tweeters. In dealing with their performance problems, the Twitter folks seem to have done two things...

Firstly, they now require HTTP Basic Authentication for all GET requests against 'friends timeline' RSS feeds - up until recently these feeds were openly available to anyone AFAIK. This actually makes sense, and simply mirrors the access control imposed on the Twitter Web site, so I'm not complaining - but it took me a while to realise why my feed requests were always coming back empty.

Secondly, Twitter seems to be throttling back the number of requests that can be made against the RSS feed in any given period, serving an empty feed if you go over the limit. This is somewhat annoying, though understandable, and I think they've always done it to some extent. But the point at which throttling cuts in seems to happen very quickly now. More importantly, I'd prefer them to return some kind of HTTP error code rather than an empty feed - at least then it would be easier to take some kind of sensible action, like backing off for a few minutes.

Whatever... to get round this limitation I've introduced some server-side caching between my in-world 'tweeter' script and the Twitter feed itself (all access to the feed goes via a server-side Perl script in any case). This means that I should never hit the RSS feed more than once every 5 minutes or so - irrespective of how many people use the in-world tweeter.

Again, this is basically a good thing - and the fact I was having problems indicates I had implemented in a slightly sloppy way. Oh well, live and learn. In general, one of the things I'm finding with building SL / Web 2.0 mashups is that you need to think carefully about where HTTP requests are being made, how often they are happening, and what throttling is likely to cut in at what point. Otherwise, you tend to leave something chugging away all hunky dory and come back a few days later to find it malfunctioning in some way.

For most Twitter applications, a delay of up to 5 minutes before seeing a tweet would be unacceptable, but in the case of the Second Friends Tweeter, which is largely a gimmick, I think it is perfectly OK.

No comments: