How Cube enables worldwide peak traffic for the Just Eat Takeaway Awards
When hundreds of thousands of people around the world visit a website or vote for their favorite restaurant at the same time during the Just Eat Takeaway restaurant awards competition, it can put a tremendous load on the servers. For an organization operating globally, it is essential that their website runs smoothly even during these peak moments. Learn how Cube developers, in collaboration with Managed Hoster Shock Media, have ensured the website remains available, even during peak traffic.
Two types of traffic.
The core of our approach starts by distinguishing two types of traffic: information retrieval (such as viewing the website) and information submission (such as voting for a restaurant). We applied separate techniques for both traffic flows, each specifically tailored to the requirements of the task.
Requesting information: Cloudflare Pages.
Cloudflare Pages is a powerful static website hosting platform that allows information to be efficiently stored and distributed globally. When a user visits the website for the first time, Cloudflare Pages delivers the content from the nearest data centre. Cloudflare temporarily stores this content in their network of global data centres (caching), allowing content to be delivered directly from the nearest location on subsequent visits. This reduces the load on the originating server and allows them to serve large numbers of simultaneous visitors without server overload.
In our particular case, the most recent version of the websites is managed through a CMS and then stored at Cloudflare Pages. Whenever a change is made to the content, a new version of the website can be deployed on a country-by-country basis. This means the updated version is sent to Cloudflare Pages via an API link and made available worldwide. This means users always have access to the most up-to-date version of the website, while the load on the server remains minimal. The global presence of Cloudflare Pages also ensures fast and efficient traffic handling, regardless of the user's location. This results in consistent, high performance and availability of the website around the world.
Submitting information using the Message Queue.
Submitting information, such as voting for a restaurant, requires a different approach. Since this information is unique to each user and cannot be cached, we chose a system based on a Message Queue. This system acts as a buffer between the user and vote processing. When someone casts their vote, this vote is queued as a message. What is unique about the Message Queue is its scalability. This queue can process hundreds of thousands, even millions of messages simultaneously by storing them and handling them at a controlled rate. This means that even with a huge spike in the number of votes, the website continues to function and every vote is eventually processed.
The Message Queue works by managing an ordered queue of messages. Each voice is placed in the queue as a structured object, complete with meta-information. A background process reads this queue and processes the messages in batches depending on the available processing capacity. This system ensures that voice processing is highly flexible and adaptable to the amount of incoming data
If there is a peak in the number of votes, as for example during the last days of the competition, the votes are temporarily stored in the queue. This queue acts as a buffer, preventing the website from being overloaded and keeping the server continuously operational. Handling of the queue is done in a steady manner, using available resources to process votes efficiently, without affecting the overall performance of the website.
Displaying dynamic information with ElasticSearch
In addition to Cloudflare Pages and Message Queue, we also use ElasticSearch for dynamically displaying content, such as nominated restaurants. ElasticSearch enables us to search and filter large amounts of data quickly and efficiently, which is essential for a smooth user experience. This means users can quickly and easily find the information they are looking for, even during busy periods.
To optimise the performance of ElasticSearch, we deploy multiple ElasticSearch instances and use a load balancer. The load balancer distributes incoming search requests evenly across these different instances. This distributes the load evenly, preventing each instance from being overloaded and keeping the search results fast. This ensures that the website continues to function reliably even with a high number of simultaneous search requests.
Collaboration with Shock Media.
To ensure that CloudFlare and its infrastructure is always available and accessible, we work with Managed Hosting provider Shock Media. An important aspect of our collaboration with Shock Media is the benchmarking and stress testing of our infrastructure. Together with their team, we simulate the expected load on the servers, mapping out exactly how the servers behave under different conditions. This allows us to anticipate potential bottlenecks and make the necessary adjustments in time. Based on the results of these simulations, Shock Media and/or Cube carries out various optimisations and tweaks to ensure that the infrastructure performs optimally. Once this test phase is successfully completed and Cube has given the green light, we are ready to go live.
Shock Media then remains constantly optimising performance. They manage not only the Cloudflare solution, but also other important aspects of our infrastructure, such as the servers managing Message Queue and ElasticSearch. Shock Media plays a vital role in ensuring the continuous availability of the website by providing 24/7 monitoring and support. Their expertise in managing Cloudflare ensures that caching and security are always up to scratch. Moreover, they manage the infrastructure for Message Queue and ElasticSearch, which means we can count on reliable voice processing and fast data display.
By combining smart global caching via Cloudflare, scalable vote processing with Message Queue, and efficient data representation with ElasticSearch, Cube has created a solution that gives Just Eat Takeaway the assurance that their website will continue to function even during the busiest times. This approach allows hundreds of thousands of users to request information and vote without problems, while minimising the load on the servers.
Ready for the next step? We are too.
Your challenge, our expertise. Together, we create the best solution - let's connect.
Worth reading next...
How digital transformation can improve your business results
The benefits of a customer portal