iPlayer Day: Performance tricks behind the scenes
This was the look of the BBC iPlayer homepage that we went live with in July of 2007. In those days we were delivering a few hundred TV programmes that could only be viewed by download to Windows PC. Looking back at them now these pages look pretty dull and empty and it was a challenge to get them to change a few times a day.
Now we deliver thousands of TV and Radio programmes. Seems like every day when I get in to work someone has dreamt up a new device to serve iPlayer content to or a new BBC service that wants to contribute programmes into iPlayer. I would never have guessed that the BBC had so many different TV and Radio stations nor that it made such a huge set of programmes.
Today's iPlayer site is built by the iPlayer Publishing Services team. The server side components for today's iPlayer site are built by the iPlayer Publishing Services team.
We are a group of OO perl/Catalyst/mysql developers who are working hard to make the iPlayer pages as rich and engaging as possible while serving 9 million page views a day each in under 2 seconds.
How do we do it?
We use every performance trick we can think of. Our database is flattened, denormalised and heavily indexed to make sql queries as quick as possible. For each query we get we build an abstraction we call our blocklist. These are the lists of programmes on the pages. We serialise these perl objects into memcached ready to reuse for a fixed period of time. We spider our object building to always ensure we have a memcached ready.
iPlayer site traffic gets up to nearly one thousand concurrent requests per second. We share head-end serving with the rest of bbc.co.uk traffic which is handled by 18 Apache web-servers running Apache 2.2 and mod_cache. Behind these sit two Zeus ZXTM load balancing/http cache servers which distribute traffic our eight application servers. Our application server config is Apache2.2/OOperl/Catalyst/memcached. Behind these are 2 mySql DB servers one master and one slave.
In addition to the iPlayer site pages we also serve Atom feeds for all the iPlayer traffic. There are feeds for every programme taste and type of user from CBBC educational TV programmes to Radio Foyle daily schedules.
Things we are working on for next year are ways of making iPlayer more personal, we'll also be refining the way we publish programmes through our player to come up with seamless ways of moving from one programme to the next.
Marina Kalkanis is Senior Technical Architect, BBC Future Media & Technology