conference wordpress site (part 2) – load testing and monitoring

In May 2016, a well motivated group of Toastmasters in Prague and Brno, teamed up to organise a “Toastmasters Leadership Institute” conference, in less than 2 months. In this mini series I explain the steps I took to get the web site up and running.

Fact: a conference site receives bursts of traffic driven by social media activity, and then sits idle for most of the day.

Load Testing

Our aim was to bring roughly 100 people to the TLI conference.

I estimated that our PR campaigns would drive about 40 visitors in the minutes immediately following our posts on Facebook. I wanted to verify that the response time of the site under such load would be reasonable (within 2 seconds?) . To do so, I created a test case in jMeter that would run 40 concurrent users, browsing every single page of the site. (how-to write a jmeter test case)

If you don’t want to learn jMeter (and all the stuff connected to load testing) , you can use , which is able to run a simple load test in 5 minutes, returning a good-enough report.


Your web site will fail! Prepare for it.

One Sunday afternoon I was walking back home, when I received a notification on my phone : “The TLI web site is down”. I notified Lukas (the “responsible person” as he called himself) and Zuzana (our PR super girl) , letting them know that I would work on it in a few minutes.

Knowing that the site was down, we delayed a social media PR campaign that was bound to send tens of visitors to our pages.

Host-Tracker is an online service that periodically visits your site, and if the site is not responsive, it can send you a notification via email, SMS, voice call, or a number of web services. The free plan allows to monitor one site every 30 minutes. (how-to create an alert in host-tracker)

Why does this matter?

Have you ever clicked on a link that took forever to load? 3 seconds feel like an eternity. 10 seconds is just unacceptable! When you choose a platform on which to deploy your site, you need to know that it can serve your expected traffic within a reasonable time frame. Fail to do so, and you’ll lose your audience.

When your site goes down, you must be the first one to know about it. Next thing you do: you notify your team, so that they don’t try to showcase the site, or launch some PR action! Be in control of your site.


Part 1 – hosting and plugins

how to create an alert in host-tracker

This short how-to will get you started with HostTracker, a simple but effective way to monitor the health of your web site

Step 1: Add a “contact”

This is the notification channel. I used “email” , but you can have SMS, Viber, Skype, or even HTTP Posts, to handle the notification with your own web service.

Step 2: Add a “check”

To check that a web page is up, use a “web site check (http)”. In the basic options you will define the URL of your site, and the interval of the checks.

Step 3: Advanced options – Content check

In the advanced options, you have the field “content check”. Make sure to use it to verify that the page you’re GETting contains some string that is expected in the live version of the page. This will verify that the site is behaving as expected. Some malfunctioning might result in some error page, that still looks like a valid response to an automated life check. If you look for a specific piece of content, your level of confidence in the check will be higher.

Step 4: Advanced options – Preferred region

HostTracker is great: it lets you decide from which region your requests should be executed. You should pick the regions that are closes to your target audience. If you have a global audience, I suggest you pick the region closest to the datacenter that hosts the site.

Step 5: intentionally take down your site (optional)

If you have the luxury of taking down the site without hurting your audience (before launching the site, or as a “scheduled maintenance”) , you will be able to actually verify that the notifications are getting to the right place.

If you don’t have this luxury, go back to step 3 and add an incorrect content check. This will result in a failed check, and subsequent notification.

how to write a JMeter test

In this how-to I will explain how to write a simple HTTP GET test with JMeter, that can be used to measure the responsiveness of a web site.

Step 1: Download JMeter

JMeter (an Apache project) requires Java to run. Once downloaded and unpacked, you can execute the UI by running jmeter.bat (windows) or (linux) in the bin folder.

Step 2: Add thread group

Set the “number of threads” to the number of users you want to simulate. I will use 10. I will leave the ramp-up time to 1 second, and the loop to 1.


Step 3: Add HTTP Request sampler

Right click the thread group you created in step 2, add >> sampler >> http request.

This object will define the actual HTTP request that you want to test, simulating the number of concurrent users defined in step 2.


Step 4: Add an Aggregate Report listener

Again right click the thread group you created in step 2, add >> listener >> aggregated report

This object will show you the result of your test. Changing the number of concurrent users and the ramp up time, you will get different results in the report. Keep an eye on the 90% 95% and 99% lines. These will give you a good idea of how responsive your site will be under load.


Step 5: multiple pages

To test multiple pages in the same site, you will need to add more HTTP Request sampler. Those sampler will share the same root address. To avoid having to type the same common configuration in each HTTP Request sampler, add a “HTTP Request defaults” config element. Right click on the Thread Group create in step 2, add >> Config Element >> Http Request Defaults.

This is particularly helpful if you have a test environment and a production environment, and the only difference between the 2 is the root of the address. With a config element you won’t need to change all the HTTP Request listeners

Step 6: add assertions

Suppose you want to verify that a piece of the response is actually contained in the page under test. Right click one of your HTTP Request sampler, add >> assertions >> Response Assertion. In the object screen, you can add a “Pattern to test” .

To verify that the assertions don’t fail, you will need to add an Assertion Results listener to the HTTP Request sampler, checking the “Log/Display Only” “errors”.


conference wordpress site (part 1) – hosting and plugins

In May 2016, a well motivated group of Toastmasters in Prague and Brno, teamed up to organise a “Toastmasters Leadership Institute” conference, in less than 2 months. In this mini series I explain the steps I took to get the web site up and running.

Fact: with less than 2 months to go and a tight budget, you can’t get fancy with the web site! This is why we decided to adopt WordPress.


For this particular event I used Windows Azure (cloud offer by Microsoft) creating a Virtual Machine size A2 Basic, based on CoreOS, in the Frankfurt datacenter (closest datacenter to our main audience).

The A2 Basic instance (2 cores, 3.5 Gb RAM, 60 Gb disk, about 70$ per month) might seem pricy and oversized, but the site needed to stay up only for 2 months, with bursts of traffic driven by our PR campaigns.

CoreOS is a linux distribution that comes with Docker preinstalled. It makes sense to use CoreOS only if you want to run dockerized applications (like in this case). Otherwise, rather go with Ubuntu or CentOS.

WordPress has an official docker image, and in its documentation it also features a docker-compose yaml file to spin a MySql (MariaDB) container together with the WordPress container, linked and configured. You might want to change your password, and if you have some time, figure out how to add SSL support.

Make sure to tune the restart policy of your docker containers. The 2 outages I experienced could have fixed themselves had I set –restart unless-stopped (or always) .

How to deploy WordPress using Docker on Azure

Plugins & Theme

  • Theme – Zerif Lite : Clean, with a captivating landing page. Customisations require you to know CSS and HTML, and to understand PHP. I know nearly nothing about PHP, but after years of web development I’m pretty comfortable with spotting logical constructs 🙂
  • Sucuri Security – Auditing, Malware Scanner and Hardening : this security plugin contains a number of functionalities to reduce the attack surface of your WordPress site. WP sites are far to vulnerable to scripted attack. Hardening your installation is a sensible move.
  • WordPress Backup to Dropbox : this plugin will backup your site (code files, media and database) seamlessly to your dropbox account. This way, should your site fall for an attack, you will be able to restore it without having to rebuild everything from scratch. Be sure to practice the restore on another installation of WP! Not having backups is bad…not knowing how to use your backups is stupid!
  • Google Analytics : this allows you to inject the tracking code that Google Analytics uses to monitor the traffic that goes through your site.
  • All-in-One WP Migration : this plugin is designed to migrate your entire site to a new installation, with just a couple clicks. It can be an effective backup strategy, with fairly easy recovery.


Part 2 – load testing and monitoring

how to deploy WordPress on Windows Azure using Docker

Step 1: Create a VM on Azure

In click the “+ new” icon at the top of the left toolbox, and choose the CoreOS Linux (Stable) image.

CoreOS VM image

Create the VM using the Resource Manager wizard. I prefer to use an SSH key instead of a weak username + password. Find the IP address of your newly created VM, you will find it in the Properties tab of your VM object

Step 2: SSH into the VM 

On Windows I use PuTTY. This will give you a shell into your CoreOS machine.

Step 3: create the docker-compose yml file

The official WordPress Docker image documentation contains an example of yml file to start a MariaDB (MySql) container and a WordPress container, linked together, with passwords already configured.

Execute these commands

  1. touch docker-compose.yml
  2. vim docker-compose.yml

Now paste the content of the yml that you can find in the documentation, and “save and exit” from vim using :wq

Step 4: install docker-compose

just run this command to download the executable, and change its permission
curl -L `curl -s | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x ~/docker-compose

Step 5: run docker-compose

run this command to “compose” your containerized wordpress deployment. This will download the docker images of MariaDB and WordPress, will spin 2 configured containers, and link them together.

sudo ./docker-compose up -d

Step 6: open port 8080 on your VM

By default, you can only use port 22 to SSH into your VM. To be able to browse your WordPress site, you need to open the configuration of the “Network security group”, and create a new “inbound security rule” to allow all traffic to port 8080.

You probably want your WP site on port 80. To achieve this, in the yml file change 8080:80 to just 80:80 . This will map the port 80 of the container to the port 80 of the host.

Step 7: browse your newly created instance

Using the IPaddress of your VM on Azure, and the port defined on step 6, you can access the site you just launched!

Congrats 🙂