General System Design Tips

  1. Always to keep your design for your application as simple as possible.
  2. Only change things once that’s required!

Distributed System

A Distributed System is basically a group of computer, aka Cluster, working together and the goal is that all the complexity should be hidden completely from the users.

From user perspective, they just interact with a single computer. Behind the scenes when you think about something like Google, Amazon, Facebook, they have multiple data center with tons of servers to manage.

Fallacies of Distributed Systems

  • Network is reliable.
  • Latency is zero.
  • Bandwidth is infinite.
  • Topology doesn’t change.
  • Network is secure.
  • Only one administrator.
  • Transport cost is zero.

Common Characteristics

  • No shared clock.
    • All the individual servers are running on their own time, and this leads an issue called Clock Drift , which the timers on each computer get out of sync, and can lead to big issues with ordering of events etc.
    • If you’ve been involved into this kind of issue, you may see an error where it seems like there is negative latency, it’s like time travel or because one clock computer is off and it sends a request to another. It will raise issues related to the timestamp on these requests.
    • To resolve this issue, Google use a combination of GPS receiver and an atomic clock, and they called it TrueTime .
  • No shared memory.
    • Each node or server in your system is going to have its own RAM and storage. So if it needs data from somewhere else, it’s going to have to request that from the part of the system that does have it.
  • Shared resources.
    • Anything in your distributed system should be able to be shared between nodes on the system, so that could be hardware, software or data.
  • Concurrency and consistency.
    • Different parts of the system are going to be working together at the same time, you want to ensure that there’s consistency between different parts.

Communication

  • Different parts of Distributed System need to be able to talk.
  • Requires agreed upon format or protocol.
  • Lots of things can go wrong, need to handle them somehow.
    • Client cann’t find server.
    • Server crash mid request.
    • Server response is lost.
    • Client crashes.

Benefits

  • More reliable, fault tolerant.
  • Scalability.
  • Lower latency, increased performance.
  • Cost effective.

Reference