Thursday, July 7th, 2005

Showcase: iTunes Counter

Category: Showcase is currently displaying an iTunes Counter that shows the number of songs downloaded, counting to the 500 million song mark.

The countdown actually uses Ajax to grab the counts from an XML that is generated and put on the server at

<count name="curCount" timestamp="Thu, 07 Jul 2005 04:51:01 GMT">484126216</count>
<count name="preCount" timestamp="Thu, 07 Jul 2005 04:46:00 GMT">484120405</count>

I wonder if they just have cron kick out a “select count(*) from …… | mysql | munge > external_counter.xml” every minute ;)

Our friend Dunstan has his hands all over, as you can see in comments (//dunstan). It looks like they increment the count, and sync up every now and then (minute) via Ajax to get the real count. Smart.

It is also interesting how they just hack on top of XHR, and aren’t using any helper toolkits.


Posted by Dion Almaer at 12:05 am

2.9 rating from 13 votes


Comments feed

“I wonder if they just have cron kick out a ‘select count(*)…'”

Gosh, I hope not. “select count(1)” is much faster. ;)

Comment by Eric Thompson — July 7, 2005

I hadn’t realized that itunes has already gotten up to the 500million mark, they’ve grown at a rapid pace. I think they are doing great things. Although I don’t like purchasing music online, nor will I, I still support them.

I’m old school and I like to buy the cds and have a phyical copy of it instead of only having a digital copy. That’s just the way I am, so I like it : )

Comment by Jonathan — July 7, 2005

I think the count is updating every five minutes instead of every minute.

Jonathan: Are digital bits on a hard drive less physical than digital bits on a CD?


Comment by Jack Kennedy — July 7, 2005

The server’s pulling down the stats every minute, but the stats are only changed every five minutes. The stats show current songs and songs five minutes ago. From that, the browser effectively calculates songs per millisecond and repaints every 100 milliseconds.

I was curious so I wrote up a walkthrough here.

Comment by Michael Mahemoff — July 8, 2005

I think the link was filtered out, how about this:

Comment by Michael Mahemoff — July 8, 2005

Might be cool to add an averaging feature which keeps track of the true increase every 5 minutes as updates come from the server, so the estimated in-between updates could (ideally) become more accurate over time.

Comment by Scott Schiller — July 8, 2005

Looking at the script, I got a kick out of the ie:mac filter (they show a static image):

“Upgrade to Safari to see the countdown to 500,000,000 songs.”

An amusing browser upgrade pitch if I ever saw one. ;)

Comment by Scott Schiller — July 8, 2005

Leave a comment

You must be logged in to post a comment.