Almost weekly there are examples of high profile websites being overwhelmed by large spikes in traffic. Fabric explore how writing web apps as a collection of micro systems improves website performance under high load.
A most notable recent example of a traffic spike caused the UK Government to extend the deadline for registering to vote in the upcoming EU Referendum on the 26 June 2016 when the registration site became unresponsive for users.
Here at Fabric, we spend our Friday afternoons exercising our creative brains and trying out technologies on hack projects.
This week we are looking at designing and building a web app that scales up under heavy load. The topic of the web app is to amalgamate various legal data sources relevant to the tech sector and to filter down to the articles that are relevant to us as a digital agency and our clients.
The underlying architecture uses micro services that communicate over a RESTful API. Decoupling development into micro services works well with a hosting infrastructure that can spin up new machines under heavy load.
For this hack we picked a technology stack that seperates the presentation layer from the business logic layer, allowing us to scale up just the layer that acts as a bottleneck under high strain. The technology stack is:
Lumen - a lightweight MVC framework - used to provide the micro services API and business logic. This cut down version of Laravel is ideal for micro services because of its lighweight footprint and fast response speed.
Guzzle - Guzzle acts as a wrapper for the underlying communication technology used to communicate with a RESTful API. Abstracting away the underlying transport code makes it easier for developers to write clean code and changing the
underlying technology in future only takes a configuration change.
Angular 2 front end framework is being used to give users an interface to find and read articles.
For database storage, we opted for MySql, a well established database engine.
To test performance we plan on using Apache jMeter to simulate thousands of users reading and writing content simultaneously.
As the results came in, it seems like the Government's EU referendum problems have gone from bad to worse. Hopefully our scaling Micro service hack will fair better. The Lumen API micro service is already up and running at http://feed.fabric.co.uk/api and the micro-services for reading our legal data sources are well under way. The Angular 2 front end work is still in research stage.
We are running two types of test, functional tests which check that the system is behaving as expected, and load tests to see how the system performs under pressure.
We are using Selenium for functional tests and jMeter for load testing.
The testing framework that we use to schedule and executing test cases is an in-house bespoke build and if you'd like to find out more about it, contact us on 0161 348 7348.
Check back next week to see how our tests performed and to take a look at the working prototype.