DEV Community

Sloan the DEV Moderator
Sloan the DEV Moderator

Posted on

Explain Distributed Systems Like I'm Five

This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment.

I hear this term a lot, but I'm not always sure what exactly it is referring to.

Top comments (9)

Collapse
 
rhymes profile image
rhymes

Like you were five: you ask your best friend a question, she doesn't know the answer, so she asks another person, who doesn't still know the answer but know someone who does, they get the answer, pass it back to the person before until it gets to your best friend. You only interacted with your best friend, nobody told you about "the others".

To have a distributed system you need to have more than one component connected by a network resulting in a single system to the user. These components talk to each other exchanging messages.

The internet is the biggest example of a distributed system. The web is another example of distributed system: you ask something to a browser, they get the answer somehow by talking to various entities linked by a network, they get you the answer back. A telephone network is another distributed system.

Let me know if there's something you're unsure about. I'm happy to expand.

Collapse
 
yaser profile image
Yaser Al-Najjar • Edited

First, let's see the difference between a system and an app:

System: is mostly where many users interact with each others (like dev.to or a hotel reservation)

App: where you use it alone (like Photoshop)

System: is like a factory where many people work to do a common goal (many services do lots of stuff to finish that room reservation the user wants)

App: that guy which works in that factory alone by himself and he is has mostly one single goal (Photoshop is mainly for creating that awesome design)

More examples:

  1. Windows / Linux / macOS are all operating "systems".

  2. Voice recorder is an app.

  3. MS Office word is an app.

  4. Whatsapp provides an app for the end users to send and receive messages, and they also have a system where you send messages and they get stored / processed then encrypted in the middle and received from the other end and decrypted.

Now that you know the difference between a system and an app, @rhymes already explained what a distributed system is...

You can see the addition on the word "systems" (in his comment) to make it "distributed": the components connect via network and talk to each others.

Just one more thing, mostly systems nowadays are a mere of SOA (Service Oriented Architecture).

Collapse
 
jamesmh profile image
James Hickey

Most products have various features. Take Amazon:

  • Search
  • Browse
  • Order
  • Payment
  • Shipping
  • etc.

Most apps have those features in one codebase, and therefore as part of one deployable (web) app.

Distributed systems build each feature as independently deployable apps.

If Payment needs info from Order, then Payment will get that data via Order's internal API (perhaps over HTTP).

If Payment needs to inform Shipping that the payment was successful: Payment will simply emit an event PaymentSuccessful that Shipping is listening for (asynchronously). Shipping will now decide to ship the order.

Other features can also listen for those events, so on PaymentSuccessful the Order feature may choose to "close" the order for further editing, etc.

In the end, distributed systems are when each feature communicates over-the-wire instead of within the same process/run-time (e.g. in code).

Collapse
 
jamespwright profile image
James Wright

How I would explain it like you were actually five.

When we want to watch a movie, we take the DVD out of the box. We put it in the DVD player. We press the buttons on the remote. The TV shows the picture.

Each piece has it's own job, and when we put them all together, we get to watch a movie.

Collapse
 
ben profile image
Ben Halpern

Five year old: What's a DVD?

Collapse
 
cjbrooks12 profile image
Casey Brooks

A distributed system is best explained in contrast to a centralized system.

A centralized system is like your school, we'll call it Sloan Elementary School. You go to school, you ride the bus, you learn from your teachers, you eat from the cafeteria, and you take pride in being a Sloan Unicorn-Sloth. Everything you do there is somehow being managed by Sloan Elementary, is paid for by Sloan Elementary, and likely has the name "Sloan Elementary" printed on it. Sloan Elementary School wears many hats and is the centralized authority for everything having to do with your education.

In contrast, a distributed system is more like the free-for-all out on the playground during recess. There are lots of kids out there from many different grades, playing many different games. The 5rd grade girls are playing kickball in the field (along with that one boy who has a crush on the pitcher), the 3rd grade is split up between Four-Square, Tag, and 2-hand-touch football, and you're having a lot of fun with your other kindergarten friends running and jumping around the playset. There is no one telling the students in each grade what they should do, they are just self-organizing and doing what they want.

But these recess game groups don't have ultimate freedom to do what they want, they need to have some structure in place amongst the games. Otherwise, you might have the football thrown in the middle of the Four-Square game and mess everyone up, or the kickball first base might be at the top of the slide. These groups need to work together to figure out where each one can play their games and come to an agreement on who is doing what so that everyone on the playground has the best time possible.

Collapse
 
cjbrooks12 profile image
Casey Brooks

In more technical terms, a centralized system would be like you building a website. You would have a single server or maybe a cluster, but it all works toward the one product, and you're managing everything with that website.

A distributed system is like the internet. No one person owns the internet, anyone is free to add new servers wherever they want. But in order to be a part of it, you need to follow a set of protocols to ensure that your new server plays nicely with all the others already on the internet.

Collapse
 
craignicol profile image
Craig Nicol (he/him)

There's a lot of children in the world, and Santa is busy in his workshop, so he can't ask them all what they want, so there's lots of local Santas to handle the queues of children, and listen to what they want, and lots of elves to check who's been naughty and nice, and lots of other elves that build the wooden toys.

Each one only needs to worry about the children assigned to them. Eventually all the information will get back to the North Pole. And it doesn't matter when, or what order, so long as it gets there before Christmas Eve.

Collapse
 
alanmbarr profile image
Alan Barr

When we do an activity like playing a game like tag we have one person be the tagger. If we want to make the game faster we could have more than one tagger. That way we can tag more people and chase them better. But not we have two people we have to communicate with on how we are going to tag and while this could be better it also creates new problems we have to solve in how to tag the most amount of people.