A quick introduction to Distributed Systems

What are Distributed Systems?

In this article I will try to explain distributed systems in simple words. So that you can understand what they are and how they can help.

At a high level distributed systems are a group of computers working together towards a common goal. For an end user or client it\’s just one computer. But behind the scenes the work gets distributed among a set of computers or servers.

A good analogy can be when you give some work to a company. Behind the scenes the company involves a set of people to get your work done. But you are probably unaware of the details.

Distributed model can especially help with horizontal scaling.

Consider databases. As the data increases splitting the data across multiple servers can help scale. It also improves fault tolerance.

So distributed systems-

  • Are a group of independent computers which connect with each other to get a job done.
  • They may connect to offer some service, share data or simply store data.
  • These computers do not physically share memory or processor.

How do they (computers) communicate?

  • They communicate with each other using protocols / messages.
  • In a distributed system the sender and receiver must be explicitly encoded in the message.
  • Messages are a great way for modular components to communicate. Messages should follow some protocol for consistency. Like in WWW we have HTTP protocol.

Example

  • Say we have two computers A and B that can exchange messages.
  • Computer A can ask B to compute sum of two numbers and send back the result. Likewise computer B can ask A to sort a list of numbers.
  • Both A and B can take different roles depending on their H/W and S/W capabilities.

When it comes to distributed systems an important concept which needs to be understood is CAP Theorem. You can read about it here.

How can computers be organized?

We can have a Client Server or Peer to Peer architecture.

Client Server

Here we have a server which provides service to multiple clients.

It’s not just limited to Internet. Even on a single machine this model is applicable. Like a program may need inputs from user. So I/O module functions as a server to the program.

One problem here is that if server goes down then the requests won’t be served. So here our server becomes a single point of failure.

Another problem is if the number of clients increases then the performance will go down.

Client Server model is good for service oriented architecture. But when we want a set of computers to divide the load among themselves then Peer to Peer model is better.

Peer to Peer

This functions more as a distributed system where workload is distributed among the computers.

All computers participate in computation and they send and receive data.

Example

If the system needs to store large amounts of data, it can distribute the same among computers which are participating in this setup.

Leave a Comment

Your email address will not be published. Required fields are marked *