Skip to content

Simply Explained: Monoliths, Microservices and Serverless

software architecture

You probably ran into the current buzzwords for system architecture: monolith, microservices and serverless. Severless is the new kid on the block, so probably less familiar than the other two. Let's see what each of them means by analogy with running a pizza restaurant, or 'pizzeria' as some would call it.

The monolith

You decide to open up a pizza restaurant.

You hire a cook, a waiter and a delivery guy. You pay rent and salaries every month, no matter how much you sell. Some would call those 'fixed costs'. You also pay for raw ingredients which is correlated with the number of sales you make. Some would call those 'variable costs'.

Congratulations, you've achieved your childhood dream of owning a pizza restaurant!

The benefits of this setup are that you know in advance what your costs are and it's easy to get started. You only need to hire and train a few employees.

But there are some downsides as well.

First, you have to keep your pizzeria up to code. You are responsible for keeping the place in line with all the food handling regulations, to keep it secure for you and your customers and to renovate the place every once in a while.

Occasionally you have to deal with someone that's not handling alcohol well. It's not too much of a trouble, but it's still technically trouble. Hiring a full time security guard doesn't seem to make financial sense at the moment.

Next, you don't deal well with changes in demand. Which is to say scaling is hard. Every year, on February 14th you get 10 times more orders than normal and you can't handle 80% of them. Customers are not happy, and take it to Google Maps reviews to complain how you ruined their Valentine's Day. Yes, customers can be irrational at times.

Can you scale? Sure, you can, but you at least need to hire more people and maybe even move into a new location. These changes are not trivial and they definitely can't be done overnight (or faster).

One day your delivery guy calls in sick so now you can't handle deliveries until he's back. That means lost revenue and unhappy customers. There's got to be a better way, you tell yourself.

Microservices

One faithful afternoon you figure out a solution to your redundancy problem with your delivery guy. You could write a specification for the delivery job. Then anyone available that could handle the specification could take the job. You don't get too attached to your delivery guy anymore, as he could be replaced at any moment. Have you turned into a cold hearted capitalist?

The main win you were going for was to be able to fulfill delivery orders even when something happened to your delivery guy. Now you realize that it's much easier to scale deliveries.

The kitchen, you think, is now a bottleneck. And deliveries now basically have no upper limit. You turn a raised eyebrow to the kitchen.

How could you do to the kitchen what you did to the delivery side of the business?

Turns out it's harder to do the same for the kitchen. That's where you receive raw ingredients, the cook and the waiter share a car and moreover your waiter has a peculiar way of communicating with the cook. Your kitchen has some tricky dependencies. But those are not good for your business, so you decide to decouple the kitchen from the rest.

Lo and behold you manage to pull it off. It takes you significantly more than 7 days and it's not an entire universe, but you're not one to compare yourself to deities.

You still have to take care of the whole pizzeria, of security, of keeping the place up to code, of vetting the personnel, but you do have some clear benefits. With this setup you achieve redundancy on a critical part of your business, which means higher availability, which means happier customers. Oh, and it's easier to scale each part of your business individually.

Serverless

Questioning your own reality for a moment you notice a HUGE company right next door. BigFoodCorp. Was this always here?!

On further investigation you find out that they can and will do almost anything for your business at a fairly low price. They are agnostic about food, not necessarily dedicated to the mission of pizza, but they do have everything on an industrial scale. And they will only charge you for what you use.

Meaning, if you write you recipes and your specifications clearly they will handle everything else. And they do mean everything.

Security? They have a security force capable of handling attacks from all but a few nation states. Your pizzeria never had to deal with anything more than a few drunk teenagers, but it feels good to know someone would fight off invading hoards for you if need be.

Scaling? You need 100 cooks for the next 4 hours? Done! They have the workforce vetted are ready to go. More seats in your restaurant? BigFoodCorp has enough floor space to seat the entire world's population. Twice over. Literally all the resources you would realistically need in your pizzeria they have to spare. Scaling couldn't be easier.

What's even more appealing to your refined business senses is that working with BigFoodCorp means you can change your cost structure to have almost only variable costs. You would achieve cashflow nirvana.

You keep thinking this is too good to be true, and while reading about other's experience with BFC, you read about some troubling accounts.

Some restaurants like yours, were hit with massive invoices. Some even went out of business because of them. The issues always seem to be mistakes on the part of the restaurant, but they are honest mistakes. For example asking BFC to heat up a new oven for each soup order and then not instructing them to turn the oven off. Or asking them to package the order in a box, and that to be put in a box, and that to be put in a box, and that to be put in a box, and that to be put in a box...

Another issue some complain about is that it's not possible to make custom demands to BigFoodCorp. You have to be the size of McDonald's for them to even metaphorically pick up the phone. Not ideal, but you see how an organization that size can't hand-hold each customer. You wouldn't change your pizza dough just because for a few customers want it with Italian wheat.

You are taken aback, but not discouraged by these cautionary tales. With the firm conviction that the whole world would and will love your pizza you make the switch.

Your customers enjoy your unique brand of pizza, yet you operate none of the infrastructure to make that happen. You have become 'restaurant-less'.

Congratulations! You now moved your pizza business from a monolith, to a microservices and finally to a serverless architecture. The world is a better place for it.

Get updates for FREE

Put in your best email and I'll send you new articles, like this one, the moment they come out. ✌️

    Won't send you spam. Unsubscribe at any time.