Skip to the main content

Site navigation

Since November 2024, the Nottingham College website and its subsidiaries have used serverless infrastructure to deliver all website services and content. Embracing serverless website architecture has allowed us to not only reduce the environmental impact of our websites, but also leverage the performance benefits of serverless design as a whole.

What is serverless?

A common misconception about serverless is that there are no servers involved. There are! The difference is that we no longer own, manage, or provision them. With conventional website hosting, such as a Virtual Private Server (VPS) or a dedicated server, a website runs on capacity that’s allocated around the clock, whether it’s handling thousands of visitors or none at all. Serverless instead runs code on short-lived, on-demand computing resources that are created as they are needed when requests arrive and shut down when they’re no longer needed, rather than sitting idle and drawing power.

Because of this, our website’s computing resources scale with the requests it actually receives. Think about an out of hours time like 3:00 AM, when very few people are visiting. With a traditional server, that machine would be running at full readiness for an almost empty site. With serverless, little to no compute is running for us at all. Some supporting services, like the database and file storage, still need to stay available, but we’re no longer powering a whole server just to wait for visitors.

One way to think about it: Traditional website hosting is like owning or renting a house. It exists 24/7, with the heating and lights running, whether you’re home or not. Serverless is like booking a hotel room only for the nights you need one. When you check out, the room is no longer yours, and you’re no longer paying for it. Our websites don’t have a server permanently running for them. The computing power only switches on when someone visits, for example, when they load the Nottingham College homepage.

What makes serverless more sustainable?

  • No idle servers. Traditional servers are sized for the busiest day of the year and run at that size every day, even when barely used. Industry research suggests that typical server utilisation is often below 30%, while idle servers still draw a significant amount of power. With serverless, computing power is only used when someone visits one of our websites.
  • Shared, efficient infrastructure. Our websites run on infrastructure provided by Amazon Web Services and Cloudflare. Large cloud providers run data centres that are typically more energy-efficient than smaller hosting setups, with better cooling and much higher utilisation of each server, as hardware is shared across many customers.
  • Doing less work per visit. Many pages are served from cache at a location near the visitor, so they don’t need any computing power to generate. The most energy-efficient request is one that doesn’t need to be processed at all.
  • No oversizing for peak demand. We don’t need to buy capacity “just in case.” On busy days like GCSE results day, capacity scales up automatically, then back down when traffic returns to normal.

Serverless isn’t a complete solution on its own. How efficiently a website is built still matters, which is why we also focus on optimised images, caching and reducing database queries for content where we can.

Did you know: On GCSE results day, we had a spike in traffic of just over 60,000 page views in a single day to the main Nottingham College website. Thanks to serverless compute, no one noticed, and this didn't impact any services or requests! The only time we did notice was when we reviewed our Google Analytics data after the fact!

Performance Benefits

While being more energy-efficient and sustainable, there are also major performance benefits to leveraging serverless compute resources, which make our websites fast and resilient!

  • Highly scalable - We don't provision any resources, as scaling is on-demand based on traffic and requests.
  • Using existing cloud infrastructure - Major cloud providers like Cloudflare and Amazon Web Services provide serverless compute globally, which we leverage to power our websites through Craft Cloud.
  • Content Delivery Networks (CDNs) - For content like images and files, we leverage major CDNs to optimise the delivery of these resources. These are also cached.
  • Static caching - A lot of our website content doesn’t change very often. When it hasn’t changed, entire pages are cached and served as ready-made pages from a location close to the visitor, without needing to run any code or query the database, further reducing energy use. Chances are, when you’re browsing the Nottingham College website, you’re viewing a cached page without even knowing it!

Craft Cloud

It’s no secret: we proudly display “Powered by Craft Cloud” in the footer of our websites. We’ve used Craft CMS for over 10 years, and more recently moved our websites to Craft Cloud, a serverless hosting platform built by the team behind Craft specifically for Craft CMS websites.

Craft CMS

Because Craft CMS is written in PHP, people often ask: “How do you run a server-side language like PHP serverless?” Traditionally, PHP relies on a web server running around the clock, waiting for visitors. Craft Cloud takes a different approach, using containers.

Think of a shipping container. Whatever’s inside, it’s a standard box that any port in the world can load, move, and unload in the same way. Software containers work on the same principle: our website’s code is packed into a container along with everything it needs to run, including PHP, Craft CMS itself, and any additional software packages needed.

Each time we publish a code update (deployment), Craft Cloud packs a fresh container with the latest version of our website. These containers run on AWS Lambda, Amazon’s serverless platform, with the help of Bref, an open-source project that enables PHP to run on Lambda. When someone visits our website, Lambda opens up a copy of the container to handle the request. If thousands of people visit at once, it simply opens more identical copies. When traffic quiets down, they’re closed again, so no computing power is wasted waiting for visitors.

What technology powers our websites?

Through Craft Cloud, there are a variety of cloud and serverless technologies in use, including:

  • Cloudflare – a global network that caches and delivers our pages close to visitors, and protects our websites with a web application firewall.
  • Cloudflare Workers – lightweight code that runs at the edge of Cloudflare’s network, routing each visitor’s request.
  • Amazon S3 – secure, permanent cloud storage for our uploaded images and files, which keeps them safe and available even as our computing power starts up and shuts down.
  • AWS Lambda – Amazon’s serverless platform, which runs our websites only when someone visits.
  • Bref – open-source software that enables PHP, the language Craft CMS is written in, to run on AWS Lambda.
  • AWS Fargate – serverless containers used to build and package each new version of our websites when we publish updates at a code level.
  • Amazon SQS – a serverless queue that handles background tasks on demand, rather than having a server constantly waiting for work.

Our experiences with serverless and Craft Cloud

Ephemeral is a fancy word for temporary. Because serverless computing power only exists for as long as it’s needed, anything written to its local disk disappears once it shuts down. To make sure data is always available when it’s needed, we store anything that needs to be kept, such as uploaded files, either in the database or in Amazon S3, a permanent cloud storage service.

The same applies to the website’s “web root,” the folder that traditionally holds public files like images, scripts and stylesheets. On Craft Cloud, these files aren’t served from the website itself. Instead, they’re uploaded to storage when we deploy and served from Craft Cloud’s CDN at cdn.craft.cloud.

On-demand scaling has one downside. If no computing power is running when a request arrives, it has to be started up first, which adds a short delay. This is known as a “cold start.” In hotel terms, it’s like arriving when no rooms have been prepared, so you wait while housekeeping gets one ready.

To avoid this, Craft Cloud keeps our live websites “warm” by sending regular lightweight requests, so there’s always computing power ready to go. On our non-live environments, such as staging, this isn’t done, so the first visit after a quiet period can take an extra one to two seconds, which is perfectly fine for testing.

Keeping websites warm does use some energy, but these warming requests are far lighter than a full page request, as they don’t need to load Craft CMS in full.

Because all website requests run through AWS Lambda, each web request and response can be no larger than 6MB. That might not sound like a problem when a typical web page is measured in kilobytes, but consider a form that lets someone upload one or more documents or images. Suddenly, 6MB might not go very far!

To get around this, file uploads skip the serverless layer entirely. The file is sent straight from the visitor’s browser to Amazon S3, and the form then submits only a reference to where the file is stored. Craft Cloud handles this automatically for uploads in the Craft CMS control panel, and we use the same approach for our own front-end forms where the 6 MB limit will be a problem.

Every web request on Craft Cloud must finish within 60 seconds. For visitors, this is never an issue: our pages load in a fraction of that time. Where it matters is behind the scenes, for tasks like large data imports, exports, or bulk updates in the control panel, which can take minutes rather than seconds.

Rather than running these tasks during a web request, we move them to the queue, which is serverless through Amazon SQS, where background jobs can run for up to 15 minutes each. Larger tasks are split into smaller batches that are processed one after another. This has encouraged us to write more efficient code, and it means heavy tasks never slow down the website for visitors.

It’s a good example of how serverless limits can actually be helpful: they push you towards building things in a way that’s faster and more efficient overall.

Our websites are serverless, remember? There’s no permanent server to log in to! With traditional hosting, developers often connect directly to a server’s terminal (via SSH) to run commands, check files, or fix problems. On Craft Cloud, that simply isn’t possible.

At first, this can feel like a trade-off, but there are good alternatives. Craft Console, Craft Cloud’s web dashboard, lets us run commands whenever we need to, and schedule them to run automatically at set times, much like a traditional cron job. We can also trigger tasks through secure web addresses (HTTP endpoints), which is useful for things like starting a data import from another system.

There’s an upside, too. With no way to log in to a server, there’s no way for anyone else to either. Every deployment starts from a fresh, identical copy of our website, so nothing can be quietly changed or left behind on a server, which makes our websites more secure and predictable.

PHP is great for many things, but resizing and converting images isn’t one of them. Image processing is demanding work, and on traditional hosting it competes with page requests for the same server’s resources.

On Craft Cloud, this work is handled entirely outside of our website. Original images are stored in Craft Cloud’s own filesystem, backed by Amazon S3. When a page needs an image at a particular size or format, Cloudflare creates that version on demand at the edge of its network, close to the visitor, and caches it so it’s ready for next time. Our website’s code never has to touch the image at all.

This is good for sustainability, too. Each version of an image is only generated once and then reused, and images can be automatically delivered in modern formats like WebP and AVIF, which are much smaller than traditional JPEGs and PNGs. Smaller files mean less data transferred, faster pages and less energy used for every visit.

With traditional website hosting, someone has to look after the servers: applying security patches, updating software, configuring firewalls, monitoring performance and planning for busy periods.

With Craft Cloud, the infrastructure is managed by the same team that builds Craft CMS. No one knows how to run Craft better than the people who made it, and every part of the platform.

This allows our website and digital team to spend more time on the things that make a difference to the people using our websites.

Moving to serverless has given us websites that use energy only when they’re needed, cope effortlessly with our busiest days, and run on infrastructure that’s continually improved by some of the world’s largest cloud providers. It’s one part of our wider commitment to sustainability, and as the technology continues to evolve.