The last couple of weeks is busy weeks (for some people) in our company because we conduct a series of workshop for undergraduate students. Apparently, I volunteer to give over one or two topics of knowledge sharing. One of the topics I brings is overview of microservices, a popular and fancy architecture.x So I would like to reshare here to give some basic understanding about what is microservices.

First, we will talk about scalability. We can scale the application to vertically or horizontally. Vertical scaling basically just add more resource like CPU or memory. While horizontal scaling means adding more instance to handle the burden. However, adding an instance doesn’t mean it works right away. Need some mechanism to make horizontal scaling works, e.g. load balancer.

How to make scaling even better? Let’s break down the monolith into multiple service and scale each service independently. This approach called Microservices Architecture (MSA). Not only impact on the system, it also change how the team scaling because each service can be developed by an independent team.

The interservice communication strategy is Restful, RPC or message queue. However, it’s not cheap and not free from problems. Information barrier may happen, integration testing is harder and deployment can be complicated. With a number of teams, it’s hard to have standard across the system and even isolate one team with another. Many things need to reconsider before really migrate to microservices, as Martin Fowler said, microservice is a classic YAGNI

How is micro is microservice? Almost all principles of OOP (like the Single Responsible Principle, Common Closure Principle, Law of Demeter and Aspects Oriented Programming) can inspire to determine the ideal service. From the organization perspective, the service should develop/maintain by small enough team (“two pizza” team) and must be autonomous. You may decompose the original monolithic service by business capability, domain, verb or noun services.

There are a few things that may require to make microservice working. Once you start microservices, the number of servers will be abundant, without such thing as DevOps, you will fall to deployment hell. Software development must implement agile to keep up with the changes and spirit of microservices. Lastly, you must code your application as it’s SAAS, which leads us to the 12 Factor Apps Principle.

I hope this article can give a few pointers to those who start to learn or use microsevices.

This article also post on medium