In 2019, amid the leadup to Thailand’s first election in almost a decade, a sense of anxious anticipation could be felt in every corner of the country. In the middle of it all stood a team led by Boonmee Lab, who were busy working on an open source project to display live election results, to be displayed at elect.thematter.co.

“Taking on this groundbreaking project was a real risk to us, as nobody on our team had experience creating a system to handle the expected traffic volume. Being entirely a volunteer project we didn’t have a budget to prepare too many contingencies, and we knew that a system failure would have been a demoralizing blow for the team. We are thankful that Mishari was there from the beginning to help design, plan, and implement the architecture that made this effort a success. His help made us confident that we would not experience a costly and time-consuming mistake.”

Rapee Suveeranont – co-founder Boonmee Lab

The Challenge

The elect.thematter.co website works by pulling data from the API of the Thai election commission. The data is then processed and displayed to site visitors. It sounds simple but there are several challenges.

First, the number of people expected to use the website was unknown, but estimated to be anywhere between one thousand and one million simultaneous users. No major global cloud providers have servers available for use in Thailand, and the bandwidth between Thailand and the nearest server location, Singapore, is often congested and sometimes unreliable. The cloud providers that do have a footprint in Thailand are either very expensive or have very little public information about their reliability, such as incidents blogs or SLAs.

Second, the cost of running the project could be as high as several thousand dollars, a large amount for a small team doing pro bono work.

Third, there were only eight days between the start of the project and the election. In that time, the team had to architect, implement, and test the entire software stack.

The original plan was to use the object store of a Singaporean cloud provider, due to their ability to handle large volumes of traffic. The previously mentioned reliability of the Thailand-to-Singapore data link was considered an acceptable trade off. However, calculations revealed that this solution could potentially cost up to ten thousand dollars, which made it untenable.

Zymple proposed using the free tier on the Cloudflare CDN (content delivery network), which could handle the work load and had a presence in Thailand. Zymple also devised simulations to make sure that Cloudflare was working properly, as passing on requests to servers directly would mean unleashing a digital stampede of traffic, causing the server to malfunction.

Another risk was Cloudflare displaying old data, as the election results needed to be updated in real time as they were reported. After testing various scenarios, the Dev and Operations team settled on a configuration that worked.

The Result

Because real time dynamically generated content wouldn’t be able to scale, Mishari and the team created a back-end architecture that generated data files, which would then be polled by a front-end script.

Additionally, the implementation of a Dev-Ops process was instrumental in the project’s success. If a traditional development model were used, the developers would have created the software and handed it over to the Operations side, who would then be solely responsible for running it. By ensuring that Operations and Development worked together to design for each other’s needs, the team was able to ensure that information flowed both ways.

On election day, elect.thematter.co was one of the most popular websites for viewing results, handling over 100,000 simultaneous users and serving over 5 TB of data, all without incurring extra infrastructure costs. There were no technical issues, and the website functioned as designed, providing real time information about election results to the people of Thailand.

Services included

  • DevOps consultancy – Creating methods for development and operations teams to work together as a cohesive unit
  • Systems architect – Designing the system for scalability
  • Feasibility and risk analysis – making sure that the solution chosen for the budget is able to handle a variety of projected loads
  • Designing and executing tests – Ensuring that the system as designed works as expected