ElectR

For a Web team, there are few events as exhilarating or as volatile as an election night. Minutes after the polls close, tens of thousands of Web users descend en masse upon the website to follow the results in real time. Each new federal or provincial election is an opportunity for Radio-Canada.ca to break its all-time traffic record.

For a Web product and its infrastructure, it is the ultimate test. Database queries must be optimised, firewalls must be able to handle high levels of traffic, and servers have to respond to each user connected. Thankfully, the Cloud market has expanded its service offering these past few years, serving up alluring solutions for the above challenges. For a two- to three-hour election night, at a very reasonable price, we can now build a virtual infrastructure that multiplies our physical one's capacity so that we can meet the exceptional election-night demands.

But once we have figured all that out, we turn to our most important job: providing users with a rich, enjoyable, and fully loaded experience. Nowadays, that means a single screen with live TV and radio feeds, social TV conversations and, naturally, customised results. Since 2007, Radio-Canada.ca had been doing all that with a Flex technology results application that performed well, but was starting to show its age and also carried the pitfall of not being compatible with all types of mobile devices.

Given the prospect of another Quebec provincial election this fall, it was high time we showed our electoral dashboard a little love. The project name was inspired by the SignalR[1] library, which we used to build the application; in our department, we now affectionately refer to our baby as ElectR.

The ElectR Solution

Figure 1 – ElectR for Tablets

ElectR ambitiously provides a one-of-a-kind destination where users can go to experience election night in real time, with full transparency, and an interface that adapts to all screen sizes. The SignalR library is an extension of the Microsoft ASP.NET[2] framework. It implements WebSocket protocol functionalities that allow it to simultaneously deliver data in real time to all users connected to a server. Unlike our former application, ElectR does not have to rely on a fixed refresh rate. As soon as there is any new data, all those who have the page open receive it.

Using a traditional Web application, the client (your browser) sends requests to the server, which responds by sending the data (text, images, etc.) displayed on your screens. With SignalR technology, each client (computers, mobile devices, tablets) keeps an open connection with the server, and it is the server that pushes data toward the clients. As you can imagine, this is something of a paradigm shift.

The ElectR project was first conceived by two members of the Music and Digital Services development team: our Applications Architect, Bruno Rovito, and our Operations Developer (Devops), Dominic Marchand. Once we had established the proof of concept, we took the prototype to Web News management to finalise requirements and begin developing the final product.

Figure 2 – ElectR for Mobile Phones

That said, the product may well have looked great and seemed highly adaptive, but to ensure that we could make it through an election night without any headaches, it had to be able to support tens of thousands of users (in 2012, Radio-Canada.ca first hit the 200,000 connections mark), and there is only one way to do that: through load testing.

To perform a load test, it was necessary to both simulate users connecting to the site and set up an infrastructure that was a good representation of what would be available on election night. Once again, it was Cloud services to the rescue; each server representing users could make 1,000 client connections. Therefore, all that we had to do was count how many of those “clients” a server could support. The closed-circuit test could be repeated several times and, while we were at it, we also simulated a server crash and a lost network connection to see how the application would react and how the user experience would be affected in those situations.

With all those precautions taken and everything we learned from the tests, ideally, the Music and Digital Services team will have only one thing left to do on election night – sit quietly and watch results streaming in and servers ramping up… because, let's face it, the only acceptable uncertainty on an election night is not knowing what party will form the next government, and the only crucial decision development teams should be making is whether they would prefer a club sandwich or a quarter chicken dinner.

References

Search highlight tool