Today, microservices are all the rage. Developers everywhere swear by the idea of breaking down large monolithic applications into smaller components results in everything becoming easier and more scalable. When done right that’s certainly true. However, like most things in tech, it’s easy for things to spiral out of control if you’re not careful. At the recently held Gapstars Explorer Series 3.0, we got a detailed introduction to this concept taking the world of tech by storm. Featuring Co-Founder and CTO of Future Labs, Thushara Jayasinghe alongside Senior Technical Lead at Gapstars, Gihan De Silva, the duo shared with us their war stories in the world of microservices.
An introduction to Microservices
During the session, Gihan offered an in-depth introduction to microservices. His talk covered everything from what exactly microservices are and how to implement them in a scalable manner.
“Traditionally, developers created large monolithic applications. They had a single database and codebase to meet all of the business needs. But as applications grew they became more complex. With microservices, applications are easier to build and maintain when broken down into smaller services that work seamlessly together,” explained Gihan introducing the concept.
After sharing the definition, Gihan shared how a basic microservices architecture works. He then went on to give a live demonstration of how it can be implemented. During his talk at the Gapstars Explorer Series 3.0, he shared with the attendees how to create a blog with microservices using AWS Kinesis, NodeJS, and MongoDB. You can check out the demo for yourself by clicking here to get started with how microservices work.
Battles with microservices in the real-world
Building upon the previous session, Thushara’s session offered a deep dive into practical aspects of implementing microservices in your application. To do so, he took examples from systems built by FutureLabs. One of them was an exam simulation platform, which utilised machine learning algorithms to help students prepare for their English examinations. A key requirement for this system was that it had to process over 5,000 requests while also keeping costs low by not consuming a vast amount of resources unnecessarily.
Having given this introduction, Thushara shared some observations from his experience. An application having a synchronous API-driven architecture will consume a heavy amount of resources. Similarly, technologies Google Cloud Run and AWS Fargate, while designed to augment Kubernetes, still have their own limitations. Finally, it’s not a straightforward process to manage a large-scale system with an AWS serverless architecture.
From these observations, Thushara then shared a new microservices architecture for the application and explained how it’d easily scale up as required. He then reminded the attendees of some critical lessons when exploring microservices. Firstly, do a proof-of-concept to prove the architecture and design. Secondly, always consider non-functional requirements. Thirdly, never forget that cloud vendors have their own limitations. In concluding, Thushara reminded everyone that, “A microservices architecture is not a silver bullet. Don’t migrate to it just for the sake of doing it.”
Should you implement a microservices architecture?
Both Gihan and Thushara highlighted there are several benefits to implementing microservices. Namely, the separation of an application into smaller independent components eliminates a single point of failure, thereby increasing resiliency. Further, it also allows teams of developers to develop, maintain, and deploy each microservice independently, update functionality with no or minimal effect on the rest of the system which speeds up the development of the application while also reducing costs. Hence, there are clear technical and business benefits to adopting microservices.
For these reasons, microservices are a trending topic in the world of technology. However, if done incorrectly, then microservices increase the complexity of an application. As such, the duo warned against developers implementing the concept purely because it was trending. During the Q&A session, it was mentioned that for smaller applications a monolithic architecture is more preferable. When it gets too big to implement a single minor change is when the question to adopt microservices should be raised. Even then, there are certain key factors that need to be considered before doing so.