Microservice architecture

karthik · updated · flag

When layered architecture is good enough for most software, there is an equally powerful and efficient architectural pattern that breaks all the components down to individual service units that can also exist on a distributed infrastructure. These units, called microservices, run independently and are loosely coupled to the other services, and communicate via APIs.

An example of a microservice is the third-party login authentications you’ve seen across the web. Another complete example is an online video platform where one microservice handles the frontend, another handles the video compression, and a different one scans for copyright violations, all distributed across systems at different locations.

Microservice patterns are now common in large companies who provide software on a global scale. This pattern enables them to have multiple instances of the same services that can be distributed to different locations, making it easy to scale.

Other key advantage of microservice model is the ‘loosely coupled’ part that makes it easy to maintain and update a component without having to deal with the rest of the components in play. For large software, this provides granular control at the cost of the added complexity of distributed systems and the barriers associated with them like latency, testing complexities, etc.

If you are about to plan your software solo, use a layered architecture. Microservice may seem tempting, but you’ll only add more complications to your software at its initial stage. If demands expand, you’ll likely know it way before, and you will have ample resources to refactor the architecture to a microservice one.