#systemdesign
What is CAP theorem?
CAP stands for Consistency, Availability, and Partition tolerance. The theorem states that you cannot achieve all the properties at the best level in a single database.
But we can only pick two out of three at a time and that totally depends on our prioritize based on requirements.
What is Data Consistency?
Consistency means that any read request will return the most recent write.
What is Availability?
Availability means that a non-responding node must respond in a reasonable amount of time. Not every application needs to run 24/7 with 99.999% availability but most likely you will prefer a database with higher availability.
What is Partition Tolerance?
Partition tolerance means the system will continue to operate despite network or node failures.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
#systemdesign#ConsistentHashing
Does load balancer use hashing?
Hashing is one of the common methods used in Load Balancing for distributing requests among the web servers.
How load balancer uses hashing?
We have something known as request_id that is uniquely and randomly generated. Each request by the client is uniquely identified by this request_id. Load balancer hashes the request_id with the proper hash function and distributes the requests.
But here comes the problem, if one server is added or removed from the pool of servers, we need to rehash all requests from the start and distribute them to the servers. So we can use the Consistent Hashing technique to solve this problem.