Managing site traffic for a TV show, but in 24 hours

handling traffic surge, lessons from Aragorn
You're having a traffic spike on your website? Learn how to migrate to Clever Cloud within 24 hours.

Surprise as it often happens: the report that was made on your company two months ago is going to be programmed tomorrow evening. Or, in the middle of a hot topic, your product is going to be the subject of an item during the 8 o’clock news.

The TV appearance is always a bad match for the web: because when you size your IT infrastructure, it’s more to manage your growth over 3 years. On a nice upward curve, usually linear. And when the traffic peaks by 800%, your architecture will be on its knees.

Except with Clever Cloud. Configuring your applications to absorb a traffic spike can be done with a few clicks in the interface:

Managing site traffic

Only, managing site traffic is easy when you are already hosted by Clever Cloud. But if this is not the case, there is no fatality.

Yesterday, M6 broadcast the show “Who wants to be my partner? And the young company BioDemain, which helps agricultural producers during the three years of their organic transition, took part. Hosted on a traditional architecture, the risk of the service falling down is great. So we helped BioDemain migrate their site to Clever Cloud in less than 24 hours!

How Clever Cloud handles these traffic spikes

First of all, managing site traffic will be done on the Clever Cloud side by load-balancers before reaching your application. These load-balancers (formerly HAProxy instances, and now instances of Sōzu, an in-house software) are going to distribute the traffic among themselves. Just like if you had Amazon ELBs (Elastic Load Balancer), except that here it’s included by default, and already configured.

Your application will then receive the traffic. Depending on your scaling configuration, your application will be able to trigger alerts to our monitoring system if CPU and RAM increase. And therefore multiply the number of instances. Load-balancers and multiple instances in a few seconds: and you are ready to handle the traffic.

The author of this article had a hard time to put up this architecture in picture

The migration itself

To move to Clever Cloud so quickly, we were put in touch with the BioDemain team. And it was the formidable support organisation that was at their side to migrate their site (here a WordPress) from a shared solution to Clever Cloud. Despite a rather… tight schedule.

Our team noticing they’re on a tigh schedule

The recipe for success was a very quick migration. Indeed, there are two ways to deploy your WordPress on Clever Cloud:

  • Quickly, with a simple FTP transfer.
  • More elegantly, using git for the code, Cellar for the media and Composer for the plug-ins.

Obviously we went for the first solution.
After contacting the developer of BioDemain, the first step was to transfer the files between the old host and Clever.
Several tens of thousands of files, so in FTP it takes time.

While waiting for the end of the file transfer, our team and BioDemain were able to deploy two other instances: MySQL and Redis. Then came the configuration of the PHP application itself (still during the transfer).
Here we had to:

Extra tech tips

  • You can also enable the Varnish built into Clever Cloud if you feel like it:
  • Put in a CDN: if you don’t have time to optimize your SQL queries, caching strategies, minifications etc., CDNs are there to offload some of the traffic to them.
  • Before anything else, lower the TTL of your CNAME and A records of your domain name. At the time of migration, if you are short of time and the changes to the domain name are propagated over 24 hours, you will find it a shame.
  • And if you ever have a down, redirect your home page to an application that displays a contact form: users can then leave an email to be contacted again.

Finally, evaluate the performance. The fateful moment of the TV pass does not suffer from a single oversight. To do this: JMeter locally (beware, it requires resources), or great online services like gatling.io

You have all the cards in hand for the next step 🙂 Good luck!

Blog

À lire également

Our new logs interface is available in public beta

You can now discover our new log stack interface and its new features!
Company

Deploy from GitLab or GitHub

Over the past few months, some customers have raised questions about CI/CD building to deploy…

Engineering

Metrics: Offloading billions of datapoints each month

Metrics are crucial to the day-to-day running of our platform. Here's how we've automated the archiving process.
Engineering