DEV Community


Posted on

Scaling Distributed Systems

Scaling Distributed Systems

Keep the maintainability and the functional requirements of the project

Will it scale?

What do we need to scale?

  • Amount of requests
  • Amount of data

Vertical scaling

Improve the server hardware

Optimize the software

Using just one server, how many users can we have?

  • Users
    • 100
    • 1000
    • 50k ?

Horizontal scaling

Splitting the load between different servers

It also improves the liability because you have more redundancy

We need to take into consideration if we have a state or not

  • If we don't, it will split the traffic between servers (stateless)
  • If we do (CAP Theorem)

    CAP Theorem Implications

    • Consistency level
      • Strict concistency - Whenever you save, the data is available for everyone
      • Eventual consistency - Theres is a delay between when you write and the data is available
    • Read Vs Write
  • Expensive

  • Increased latency

  • All the servers have access to the data

  • Sharding/Partitioning - Independ Systems

    • Sharding by value (ex. Europe, America, Asia)
    • Hash (The value has an hash and depending on that, we decide where it's stored)
  • Replication - Multiple copies of the same data in different servers

    • Used for read intensive applications

Layered architecture with horizontal scaling example

  • UI
  • Logic
    • Logic1 | Logic2 Logic3
  • Database
    • Database1 | Database2 | Database3

Discussion (0)