DEV Community

Filipe Costa
Filipe Costa

Posted on

How to start with micro services ?

When are the best moment to start with distributed system ?
When i have decide about decouple my system in a distributed system ?

Our Case

Imagine a bakery where have a one baker, imagine after now our orders increase a lot and his baker can't make breads for everyone, what is your better way ?

Image description

When the distributed system are important ?

our can pay more money for this baker to him to make more breads and working more hours to attending our clients, yes ?

probably our baker can achieve our goals , to attending more clients , but we have a some problems with this approach.

some problemas we can have

  • our baker might get sick
  • our baker may resign

if any this situations happen , all our clients not can have breads , this is called single point of failure.

Image description

How the moment to start a micro services structure ?

I believe when we have a lot of orders(requests) and our system that's so important to many clients and a single point of failure can destroy our company.

first step

Our baker probably make a do a lot of things, made breads , sweet breads, pizzas, manager delivery , charge clients, how many responsibilities to this baker , no ?

the first step for me, we can choose the main responsibilities for this baker .

for our context, the main responsibilities are make breads and sweet breads.

if you pay attention on our problem , our bakery have a lot of responsabilities, the first step problem is a remove all responsabilities that not are to a baker job, like charge money, manager delivery system ant many other things.

our first service

we need a new worker , his name is gateway , this worker are distributed the orders in our bakery .

then when a new customer to go our bakery our customers talk first with our worker gateway and gateway distruted the orders in our bakerey.

second service

our first service are called kitchen , kitchen are responsibilities to do breads, sweet breads, pizzas and all other things related like food.

Image description

third service

another responsibility that we removed from our only baker is manager delivery , when send a ready order , manager a transit deliver and many things about delivery system in a bakery shop.

Fourth Service

We removed another responsibility from our baker: handling money. It’s very difficult to bake bread while also managing financial reports and taking care of cash transactions.

Final Structure

Why is this our final structure so important? Our primary goal was to eliminate a single point of failure. If our baker gets sick at any point, it’s no longer a problem. We can simply hire another baker to keep things running smoothly.

Another issue we addressed was reducing the responsibilities of our sole baker. Now, we can easily improve our bakery by scaling the team. Need more bakers? No problem, we hire additional bakers. Too many deliveries? That’s fine, we can hire more people to manage addresses.

Image description

This is the first part of our article. Comment below if you’d like to see part 2!

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay