How about an onslaught of 1.5 million unexpected visitors over July 4th weekend? OK!

The Friday before the 4th of July weekend we got word that a story on our client’s site, SammichesPsychMeds.com was struggling to handle a sudden traffic surge.

We have hosted Sammiches & Psych Meds, a parenting, humor, and lifestyle website for a couple of years, which generally gets between 5,000 and 20,000 visits per day. Prior to Friday, daily site activity peaked at around 50,000 visitors. We had the server configured on a basic single performance core with 4 GB of RAM. The site also uses varnish which is a front-end cache to deliver content before it hits WordPress and even then WordPress serves content using WP Rocket.

Why hello there! Would you like an onslaught of web traffic with your coffee this morning?

Laura, Sammiches’ site owner, doesn’t have the big budget of some clients so we tried everything to work with what we have to maximize resources without adding additional costs. Unfortunately that was unavoidable so we boosted the configuration temporarily to 8 cores with 32 GB of RAM. It seemed to hold for a bit but then became overwhelmed. And we know that visits = impressions = revenue.

htop showing high process use. Traffic had died down but the server was still struggling.

Unlike other hosts we have the ability to control individual aspects of the server. We do not lock our clients into profile packages, such as 8 cores comes with extra hard drive space – and there is no way to go back to the previous profile. Also, unlike other hosts, we do not charge a premium for bandwidth; unlimited bandwidth is included in all of our packages. This way should you get popular, like Sammiches, you don’t have to worry that the meter is running while traffic flows inbound.

Eventually we looked at the technologies and realized we were still running some older technologies, specifically nginx 1.6 and PHP 5.6. Knowing that PHP 7 is good and stable and provides a performance boost we decided we would take the drastic move of replacing nginx and PHP while the site was still running.

We replaced nginx 1.6 with the latest stable version, 1.10. No problems. No difference. We were still seeing load averages above 100 (125 at it’s peak).

We then decided to replace PHP. We have done this before so we were ready to do it quickly because any downtime or missed hits are bad. Within 60 seconds we uninstalled PHP 5.6 and installed PHP 7.0 (7.1 has proven a bit unstable with some WordPress plugins). We did it quickly enough that were no downtime notices.

After clearing the varnish server, restarting nginx and reloading PHP we looked at our activity monitor and were amazed. On the 8 cores the load average was running at 6 (about 75%). Worried that something was not running or was truly broken. Nope, it was just humming along, cool as a cucumber.

htop after upgrading to PHP 7

Over the weekend the site attracted over 1 million visitors to view the article Micro-Generation Born Between 1977-1983 Given New Name. We had no idea the performance change that PHP 7 could bring but we are now true believers and are actively testing all of our clients’ sites to get them upgraded ASAP!

 

We eventually pushed slightly over 1.5 million views over a 5-day period. Now that traffic is back to normal we will lower the resources back to pre-surge levels but will always be ready if another surge hits.

Congrats to “Lola Lolita” and Sammiches for breaking the internet and we are happy that we could be a part of the wild ride. And if you didn’t know this is something we offer have a look at our hosting packages.

Leave a Reply

Your email address will not be published. Required fields are marked *