#diwd Drupal Rocks It In The Isles

5 minute read
Dee-Ann LeBlanc avatar

Are you the type that just uses sites like MTV.co.uk, or are you more one to stare at it and try to figure out what it's running? I could say that it's running Drupal (news, site), which it is, but the answer isn't quite that simple.

Content and Users, No Problem

Suffice it to say that MTV.co.uk gets a lot of traffic. On top of that, the site is chock full of music videos (over 16,000), TV archives, articles, news and far more. Much of this content is interlinked, with each video mapped to an artist, an image and other related items.

And not all of this content is local. Some of it comes from TV Guide. Some comes from the massive content collection at MTV.com in the US. The same small group of developers is also now responsible for MTV Australia and New Zealand and has also built the site Viva.tv, which is currently the top music channel in the UK (perhaps since it's freely available).

Technology Overview

The MTV.co.uk Drupal build-out features a lot of well-known, popular modules such as CCK, Views and Panels. Right now it's running on Drupal 5. Using the Sections module lets them assign themes using parameters such as a page's path. jQuery also features prominently across the site.

There are a ton of custom modules for tasks such as pulling in TV Guide information, custom Ajax web forms, and handling user opt-ins for a variety of "crazy legal requirements." Then there's the modules built to handle integration with services such as iTunes, Omniture, advertisements and a social networking platform they purchased called Flux.

The servers run CentOS Linux, Drupal and MySQL. There's also a SAN and a load balancer. They also use Akamai when it comes to ensuring the site stays up and running. 

User Authentication Broken Out

Flux is a key part of the site's infrastructure. It handles user accounts and authentication, allowing you to use the same account across the MTV and related web properties. Using this platform also takes a lot of load that otherwise would go onto the Drupal and MySQL servers, freeing them to focus on the content.

When you're looking at a page on one of their sites, you're seeing content provided by both Drupal and Flux. Most of the page comes from Drupal, which knows nothing about whether you're an anonymous user or authenticated. Anything user-related comes from Flux, put into place with custom modules. The ratings widgets also originate with Flux.

Each content resource gets a unique ID within Flux as well. Doing so allows the team to query Flux with that ID to, say, find out how many people have commented on that piece of content.

For those who don't own a tool like Flux, the team recommends Kickapps, which offers a Drupal plugin.

Heavy Use of Panels and Views

Use of Panels and Views is particularly heavy. Doing so lets the editorial and design teams rapidly build out new sections without needing any new development. Components are easily reused and staff can just point and click.

There are two main types of panels in the MTV.co.uk backend:

  • Panel nodes: Built for special pages like the home page. On the backend, MTV site editors see the home page as a big collection of small movable blocks that serve as content boxes. Click a button to make a block visible or not. If desired, embed Views.
  • Panel pages: Configurations that can be re-used all over the site.

Views handles a lot of layout and custom field rewrites.

Learning Opportunities

Caching, Caching, Caching

All of those little content blocks have to be individually loaded every time a page is called up. To keep from completely crushing the servers, everything except for the user portions of the content is cached. User-related items are loaded dynamically from Flux.

Another tool holding back the traffic tide is Memcache. The team did some metrics before adding it and found that loading the home page involved 1,600 queries before Memcache was installed. Adding this caching tool reduced that number to 200.

They actually changed some of Drupal's caching behavior as well. For example, a lot of caching is typically done on a page by page basis. However, since nodes are nodes are nodes, MTV.co.uk has a global node cache instead.

Purists should cover their eyes or block off the rest of this paragraph. When they upgraded from Drupal 4.7 to Drupal 5, they dared to hack core to add Memcache everywhere.

A Note On Viva.tv

Since Viva.tv is a newer property, it's built on Drupal 6. The site only took six weeks to build, the theming was far easier to create and it uses a media player UI that keeps content viewing for videos, galleries, cast information and so on consistent across the site. More community features are coming in the new year.

Paul Reeves, Senior Developer for MTV Networks in the UK and Ireland, says their design team was noticeably happier theming for Drupal 6 than for 5. So much so that they're pushing to migrate the other sites as well.

Future Plans

A web dev's work is never done, and there are always ways to improve site performance in particular. For search, they currently use the Google search appliance. However, what they've discovered is that if the pages are taking too long to load, the appliance doesn't gracefully back off. As Reeves, put it, the appliance can then somewhat "load test your site for you." They're looking into switching over to Apache Solr instead.

Another area of possible improvement is to install a dedicated Drupal webforms server. And of course they plan to start offering other internal groups access to their polls, competition code and other Drupal items, slowly indoctrinating their unsuspecting vict ... I mean, colleagues.