Jonathan Ishmael, lead technical architect at BBC, explains in a blog post why BBC Online is serverless and how they optimise it. So the key is AWS Lambda for most of the core implementations due to its ability to scale extremely fast. This is essential considering the huge traffic and workloads in the media.
For example during the US Election, the BBC News website received visits from over 165 million unique browsers from around the world.
“During the election week the Web Core stack averaged 80,000 requests per minute, peaking at 120,000 requests per minute to our platform. Those requests are the ones which made it past the traffic management layers (caches) in front of us. At its peak our edge traffic managers and CDNs saw 2.5 million page views per minute (around 41,000 requests per second),” writes Ishmael.
BBC engineers use serverless for two high CPU intensive areas of the application that require unpredictable scaling. The first is the React app that server-side renders the HTML, and “the second is the business logic layer, which transforms data from many different BBC systems into a common data model”. They are running over 100 million serverless function invocations per day.
Caching is done between the Lambda layers. It is performed to reduce function chaining, where one Lambda calls another Lambda and then waits for it to complete. This chaining incurs additional costs as Lambdas are charged proportionally to their execution time, even when they are idle. Another reason is to allow the backend serverless function to refresh the cache in the background without a user request having to wait for it.
“As an example, let’s take the breaking news story around the London Bridge attack in November 2019. The traffic profile at our edge cache for this page resulted in a 3x increase in traffic in a single minute (4k req/s to 12k req/s) followed by a near-doubling of traffic a few minutes later (12k req/s to 20k req/s).
These key moments are critical for the BBC, and they are the moments in which the audience turn to us. We must not fail. Any technology we choose must be able to respond to these traffic patterns.”
You can read Ishmael’s full blog post HERE.