Microservices: Stone Soup for the Enterprise
Microservices are the starting point for your technical transformation, not the end
September 21, 2020
Setting: Europe, During The Napoleonic Wars
Once upon a time, a soldier was returning from war. It was a long trip back home and on the way he came to a village. This village had been scarred by the war; everyone was huddled in their houses, unwilling to go out and help their neighbors. The soldier was hungry after walking all day and went to every house in the town, asking for some food. But no one would give him anything to eat.
When the soldier came to the last house, instead of asking for food he told them that he only needed a pot of water. He said that he had a magic stone and with a pot of water he could use it to make stone soup, the most delicious soup in all the world. They looked at him doubtfully, but gave him a pot and some water. The soldier went out to the center of the village, started a fire, put the pot and water over it, and put his magic stone into the pot. The villagers slowly left their houses and gathered around the soldier, waiting to see how his magic stone worked.
After a while, the soldier said, "Stone soup is the most delicious soup in the world, but do you know what makes stone soup even better? A few carrots." And one villager went back to their house, got some carrots, and put them into the pot.
After a little longer, the soldier said, "Stone soup with carrots is so good and nourishing, but do you know what's good in stone soup? A few potatoes." And one villager went back to their house, got some potatoes, and put them into the pot.
And as the pot continued to boil, the soldier said, "Carrots and potatoes really hit the spot, but stone soup really benefits from some meat." And a villager went back to his house, gathered up some chicken, and added it to the pot.
And then the soldier said, "The magic stone in stone soup is really the best spice in all the world. But some additional spices never hurt." And several villagers went back to their homes and brought back spices and herbs. And the soldier added them to the pot.
And then a villager asked the soldier, "Do you think other vegetables would make stone soup better?" And the soldier said, "Absolutely!" And everyone in the village went back to their homes, brought what they could, and added it to the pot.
When the soup was finished, everyone in town joined the soldier for dinner and they ate and laughed and shared. Everyone agreed that stone soup was really the best soup of all.
Setting: Bland Office Building, But Certainly Not Yours
Once upon a time, there was a company. And this company had problems with their software. The code was so hard to understand and deployments were so complicated and bugs were so hard to track down that nothing was getting released. Their customers were unhappy and every group in the company spent every day blaming every other group for all of the problems.
So one day, the CEO hired a consultant to come to the company. And the consultant went to each team and tried to find out what was going wrong. But each team was scared of the consultant, afraid that he would tell the CEO that they were the reason why nothing was working correctly. They pretended to be helpful, but gave the consultant as little information as possible and sent him on his way.
After spending time with all of the teams, the consultant issued his report. It said, "All of your problems could be solved if you would just use microservices!" And the teams were doubtful, but one team agreed to start breaking apart the monolithic application into a set of microservices.
And the consultant said, "Breaking apart a monolithic application is great, but do you know what really makes microservices even better? Automated unit tests. Unit tests make microservices work really well." So the team wrote some unit tests to validate their microservices.
And then the consultant said, "You know, automated unit tests and microservices are really fantastic, but continuous integration, that's really the secret to microservices." And another team was curious so they stood up a CI server to automatically build the code as soon as it checked in to source control.
And then the consultant said, "Continuous integration is just great, but what really makes microservices hum is code quality metrics." And then another team stood up a server to report on code quality, and people started using that feedback to find issues in their code.
And then the consultant said, "Wow, code quality metrics are just what microservices need, but adding some runtime monitoring support to the code makes microservices really shine." And the operations team stood up a monitoring service and the developers integrated the monitoring service into the code.
And then the consultant said, "Now that we have the runtime monitoring support, our microservices are going to be the best. But microservices really benefit when deployments are automated." And the teams replaced all of their half-documented manual deployment steps with scripts and infrastructure-as-code.
And then the manager for one of the teams came up to the consultant and said, "I've been reading up on microservices, and some people say that containers are good for microservices. Are they right?" And the consultant said, "Absolutely!" And so the teams built their code to run inside of containers.
And another team lead said, "How about deploying to a cloud provider and using auto-scaling and load balancing? Does that help microservices?" And the consultant just nodded and they started to work on porting away from their own data center to the cloud.
And eventually, the company had completely changed their processes, automating the testing, building, and deploying of their code. Products were shipping again and customers were happy. And everyone agreed that microservices were the best architecture of them all.
You can try to improve your organization directly, by proposing more automation and cross-team collaboration. But don’t be surprised if things go easier if you start with a magic stone. Change is difficult. Working together is difficult. Sometimes, people need some extra motivation to work together and do the right thing. And if that requires a little sleight-of-hand, that’s okay.
I’m not the first person to recognize similarities between the story of Stone Soup and enterprise development; Andrew Hunt and Dave Thomas refer to the story in the introduction to The Pragmatic Programmer. They say that starting a project and showing success encourages others to join and build on that success. This is true, but sometimes technological curiosity is enough to get people to contribute.
There is absolutely nothing wrong with introducing microservices at your organization. But you need to be aware that the microservices are simply the stone - it’s the improved technical and organizational procedures that are the essential ingredients. If you break up a large application into lots of tiny parts and don’t take the steps necessary to create a more nimble technical organization, you will end up with something as appealing as a boiled rock.