The size of a Microservice
This is another TIL coming form Sam Newman's book — Building Microservices.
I heard a lot of times, that Microservice is small, independent and cohesive piece of software. Independence and cohesiveness is all about responsibility — our microservice should do one thing and one thing only. When it starts doing more things, it looses those properties. Of course, it's not easy to verify if something is cohesive and sometimes the independence is fuzzy as well.
However, for me, the fuzziest terminology is small. This is a relative term. For example the source code of Google Chrome has ~4.5 M Lines Of Code. It's definitely huge. But it's small relative to the size of Linux Kernel, which has ~27.8 M LOC.
So what really is small in terms of Microservice? Sam Newman in his book describes small as something which can be rewritten in two weeks. That's general rule of thumb, and it makes me feel quite comfortable to work with. Obviously, it's not perfect rule — are we talking about rewriting by one person? Or maybe 30 people? Depending on the size of the team, and it's experience, we can have different size of a project which still can be rewritten in two weeks.
Anyway, I find this rule very helpful. Especially during discussion. It's better to give rough estimate than nothing at all.