<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/blogs/shared/nolsol.xsl"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>

<title>
BBC Internet Blog
 - 
Jeremy Tarling
</title>
<link>https://bbcbreakingnews.pages.dev/blogs/bbcinternet/</link>
<description>Staff from the BBC&apos;s online and technology teams talk about BBC Online, BBC iPlayer, and the BBC&apos;s digital and mobile services. The blog is reactively moderated. Posts are normally closed for comment after three months. Your host is Eliza Kessler. </description>
<language>en</language>
<copyright>Copyright 2012</copyright>
<lastBuildDate>Wed, 14 Dec 2011 17:00:00 +0000</lastBuildDate>
<generator>http://www.sixapart.com/movabletype/?v=4.33-en</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs> 


<item>
	<title>BBC Weather: changes to technical architecture</title>
	<description><![CDATA[<p>The <a href="https://bbcbreakingnews.pages.dev/weather/">BBC Weather website </a>has recently been relaunched after a public beta. Peter Deslandes <a href="https://bbcbreakingnews.pages.dev/blogs/bbcinternet/2011/11/bbc_weather_beta_update_response.html">has blogged about the public beta </a>and response, and<a href="https://bbcbreakingnews.pages.dev/blogs/bbcinternet/2011/11/bbc_weather_design_refresh.html"> Mel Seyer has explained the UX journey. </a></p>
<p>
<div class="imgCaptionLeft" style="float: left; "><br /><img class="mt-image-left" style="margin: 0 20px 5px 0;" src="https://bbcbreakingnews.pages.dev/blogs/bbcinternet/img/bbc_weather_technical_architecture_simplified.png" alt="The technical architecture for the BBC Weather site in a simplfied diagram" width="249" height="754" />
<p style="width: 249px; color: #666666; font-size: 11px;">The technical architecture for the BBC Weather site in a simplfied diagram</p>
</div>
</p>
<p>I work as a Technical Architect with the Weather team, and this post talks about some of the changes we've made to the architecture of the site to ensure the new site stays reliable, performant and able to scale to the traffic levels that BBC Weather attracts</p>
<h2>Weather as a service</h2>
<p>The previous version of the BBC Weather website ran on a dedicated two-tier architecture, with business and presentation logic wrapped up in a PHP front-end that communicated directly with a MySQL database. These machines sat behind the BBC News Apache mod_cache head-end servers, providing the scaling necessary for Weather traffic spikes.</p>
<p>For the new site we've moved to a three-tier architecture, keeping presentation logic in a PHP front-end but moving business logic and DB access down to a Java/Spring mid-tier service layer that presents <a href="http://en.wikipedia.org/wiki/Representational_state_transfer">RESTful</a> HTTPS APIs back to the PHP front-end for data reads, and to the BBC Weather Centre's data ingest system for writes.</p>
<p>This move is part of the BBC's wider strategy to move to a <a href="http://en.wikipedia.org/wiki/Service-oriented_architecture">Service Oriented Architecture</a> (SOA) to increase cross-product interoperability and data reuse. The diagram at top left gives an idea of how the tiers relate to each other in Weather's case (in practice this arrangement is replicated over two data centres)</p>
<p>The mid-tier REST API makes data available to the presentation layer as <a href="http://en.wikipedia.org/wiki/JSON">JSON</a>, providing separate feeds for different page components. We set different Cache-control:max-age headers for different feeds according to how frequently the data is updated, and combine this with <a href="http://en.wikipedia.org/wiki/HTTP_ETag">HTTP eTags </a>to make subsequent requests more lightweight when the feed's max-age has been reached.</p>]]><![CDATA[<h2>Scaling</h2>
<p>The new Weather site now runs on the same dynamic platform that hosts the BBC Homepage and iPlayer. To protect this shared platform from spikes in Weather traffic (up to six million users/per day when it snows, and around 2 million on a typical day) and provide a responsive user experience we've introduced a multi-tier caching strategy:</p><ul>
<li>the <a href="http://en.wikipedia.org/wiki/Varnish_(software)">Varnish HTTP accelerator </a>caches fully rendered pages in front of the PHP tier;</li><li><a href="http://en.wikipedia.org/wiki/Memcached">Memcached</a> stores JSON within the PHP tier and reduce calls to the Java service layer</li>
<li>Apache <a href="http://httpd.apache.org/docs/2.0/mod/mod_cache.html">mod_cache</a> in in front of the Java service layer to cache data requested by the PHP tier and other clients</li>
<li><a href="http://en.wikipedia.org/wiki/Ehcache">Ehcache</a> within the Java tier to cache database and third-party service responses</li>
</ul>
<p>Weather pages leaving the PHP tier will typically carry 'Cache-Control: public, max-age=180, stale-while-revalidate=30' to enable caching in Varnish (and beyond) for UK users. The total caching time across the three tiers is around 10 minutes, to enable staff at the Weather Centre to make edits to the data and the public see them on the live environment soon after. As well as protecting the shared platform from load spikes the front-end Varnish caches also provide users with a highly responsive experience.</p>
<p>When the shared platform is under very high load (for example during high profile news events or when it snows) we fail over to a <a href="http://en.wikipedia.org/wiki/Content_delivery_network">Content Delivery Network (CDN), </a>forcing pages to be cached outside of the BBC's servers. In previous versions of the Weather website this led to a loss of personalisation (favourite locations stored in a cookie) but in this release we handle personalisation on the client-side, using <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XHR</a> to make follow-up requests once the basic page has loaded and the favourite locations cookie has been read; both the basic page and the location data fragments are cacheable in the CDN</p>
<h2>Location data</h2>
<p>The previous BBC Weather site used its own location gazetteer, one of several location datasets around the BBC. For the new site we've moved to using a new mid-tier service for location data. This new service (called Locator) lets front-end products get data from a REST API that the BBC has associated with that place (weather forecast ID, TV and radio region, local news area, etc). This service is now used by the new Weather site and the new BBC Homepage, and will soon be used by other BBC products that need to associate data with a place.</p>
<p>Locator draws its gazetteer from the open <a href="http://www.geonames.org/">Geonames</a> dataset. As a result the URL for a location on the new BBC Weather website will be /weather/:geoID, so for example <a href="http://www.geonames.org/2655984/belfast.html">Belfast </a>has the BBC weather forecast page URL <a href="https://bbcbreakingnews.pages.dev/weather/2655984">www.bbc.co.uk/weather/2655984</a>. I was cautious about using these geoIDs as they aren't <a href="https://bbcbreakingnews.pages.dev/blogs/radiolabs/2008/06/the_simple_joys_of_webscale_id.shtml">web-scale identifiers</a>, plus anyone who's tried it will tell you that managing 3rd-party IDs can be a headache. But for the 20,000 or so populated places that the BBC provides forecast data for they will make it easier for us to integrate with other BBC (and non-BBC) services, using the geoID as a link - for example the BBC's <a href="https://bbcbreakingnews.pages.dev/blogs/bbcinternet/2010/07/bbc_world_cup_2010_dynamic_sem.html">semantic data publishing platform used in the World Cup</a> will use geoIDs as identifiers for locations in its event models.</p>
<h2>Behaviour Driven Development</h2>
<p>Another key aspect of the new site development was a focus on code quality. We were fortunate to have had a Developer In Test embedded in the team for the first few months of the project, who helped get the developers up to speed with the practices of <a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">Behaviour Driven Development</a> and worked with the Product owner to describe the requirements as testable <a href="http://en.wikipedia.org/wiki/Cucumber_(software)">Cucumber</a> features and scenarios.</p>
<p>We used <a href="http://hudson-ci.org/">Hudson</a> for <a href="http://en.wikipedia.org/wiki/Continuous_integration">Continuous Integration</a>, running unit tests on code commits from our integration environment. Cucumber tests run at scheduled intervals on our testing environment so we had a good chance of catching integration bugs quickly. Code review happened through a combination of frequent pair-programming and scheduled review sessions, where developers talked through what they had been working on with each other.</p>
<p>I have no doubt that these practices helped the project to deliver to schedule and specification, and have provided a more stable, maintainable and extendable codebase.</p>
<p><em>Jeremy Tarling is Technical Architect, BBC Weather, BBC News &amp; Knowledge</em></p>]]></description>
         <dc:creator>Jeremy Tarling 
Jeremy Tarling
</dc:creator>
	<link>https://bbcbreakingnews.pages.dev/blogs/bbcinternet/2011/12/bbc_weather_technical_architec_1.html</link>
	<guid>https://bbcbreakingnews.pages.dev/blogs/bbcinternet/2011/12/bbc_weather_technical_architec_1.html</guid>
	<category>Weather</category>
	<pubDate>Wed, 14 Dec 2011 17:00:00 +0000</pubDate>
</item>


</channel>
</rss>

 
