Microservices architecture is a hot topic when it comes to software development and current trends. The popularity of Microservices is disrupting operational landscapes in the digital world, and with the growth and evolution of Platform-as-a-Service (PaaS) and Infrastructure-as-a-Service (IaaS) solutions set to continue, we are seeing a mass exodus away from old monolithic models.
Generally speaking, microservices is a practice of developing software systems using smaller interlocking pieces that can easily be updated and executed independently. This has key benefits, with regard to maintenance of source code (as business needs change), as well as performance, scalability, and reduced costs of ownership.
Traditional software system design is often described as monolithic when the architecture is developed as one piece. This means that all the code for all operations performed by the application are deployed from the one spot which adds to the convenience of running the application. However, say the initial application is successful and as your business grows so does the application. It gets bigger, more complex, requiring more developers to work on it and before you know it, you’ve created a monster. The monster will remain friendly for as long as your business doesn’t need to make changes…
But with the constant evolution of business, adaptions and new features will need to be built, and as the complexity of a software ecosystem increases, it is unable to evolve on a single system. Every time a change is made, the system becomes less recognisable and more like a giant Jenga stack, ready to collapse at any point. There are several reasons why this monolith eventually becomes too difficult to manage:
The solution to the problem? Develop your app with a focus on microservice architecture. Martin Fowler who has written extensively on the topic including a very thorough Microservices Resource Guide describes microservice architecture as ‘suites of independently deployable services’, meaning applications are simpler to build and maintain, and are scalable and modular in their design. You will still have the same set of functions that will communicate with the user interface and the database, but they are decentralised. The picture below is a simple depiction of how this might look and clearly shows how microservices allow you to isolate an manage individual functions.
As well as being flexible to business changes, and thus code changes, the demand for certain software platforms can ebb-and-flow. We've seen news articles about servers and systems that can crash, during a heavy demand period. This was seen during the Australian Census, and is often seen when a popular ticketing event is on sale, such as Taylor Swift, or the Foo Fighters- or the AFL Grand Final.
Microservices allow for independent services to be automatically extended to serve more traffic. A specific function may be duplicated into 20, 50 or even 100 worker processes. When the demand has subsided, this is then reduced.
The end result is that the through-put is maintained for the end user, and, the application does not need larger servers, or more hardware, but can be elastic in nature, to stretch and shrink
Microservices are commonly being used for brand new projects but they are also being widely used to rearchitect existing applications. Below are a few examples of tech challenges solved by microservices.
Amazon is probably the best-known example and the first business of its kind to break down a large architectural monolith into microservices. By decoupling service architectures and embedding the service and dependencies as a single entity, deployable on a container, they were able to revolutionise their business scaling up from a simple online book store to a major retail giant.
Netflix is another pioneer in the world of cloud-based applications. Their ability to successfully deliver entertainment at the click of a button to more than 137 million streaming subscribers globally is phenomenal. They have managed to achieve all this by changing their entire application architecture to fit a microservice model. Netflix estimate to have over 700 microservices with each having complete control over its unique function e.g one microservice will store your history of watched show, one will use an algorithm to make suggestions based on your history, one will deduct your payment each month and so on.
The image below is an actual image that Bruce Wong, Netflix engineer, captured in 2014 depicting their microservices in action. The complexity highlights just how detrimental one error could be if it was built using traditional monolithic architecture. However, because their entire system is structured using microservices, a small team of engineers can easily adjust each function as required.