System Design
https://github.com/donnemartin/system-design-primer
Load Balancer
Web Server
Database
Cache
Scaling of hardware
Horizontal
addition of new machine like new server pc
Vertical
addition of new hardwares in same machine like increasing ram and hdd
Performance vs scalability
Availability vs consistency
CAP
Availability patterns
There are two main patterns to support high availability: fail-over and replication.
Content Delivery Network
A content delivery network (CDN) is a globally distributed network of proxy servers, serving content from locations closer to the user. Generally, static files such as HTML/CSS/JS, photos, and videos are served from CDN.
Load Balancer
Web Server
Database
Cache
Scaling of hardware
Horizontal
addition of new machine like new server pc
Vertical
addition of new hardwares in same machine like increasing ram and hdd
Performance vs scalability
- If you have a performance problem, your system is slow for a single user.
- If you have a scalability problem, your system is fast for a single user but slow under heavy load.
Availability vs consistency
CAP
In a distributed computer system, you can only support two of the following guarantees:
- Consistency - Every read receives the most recent write or an error
- Availability - Every request receives a response, without guarantee that it contains the most recent version of the information
- Partition Tolerance - The system continues to operate despite arbitrary partitioning due to network failures
Networks aren't reliable, so you'll need to support partition tolerance. You'll need to make a software tradeoff between consistency and availability.
CP - consistency and partition tolerance
Waiting for a response from the partitioned node might result in a timeout error. CP is a good choice if your business needs require atomic reads and writes.
AP - availability and partition tolerance
Responses return the most recent version of the data available on the a node, which might not be the latest. Writes might take some time to propagate when the partition is resolved.
Availability patterns
There are two main patterns to support high availability: fail-over and replication.
Active-passive
With active-passive fail-over, heartbeats are sent between the active and the passive server on standby. If the heartbeat is interrupted, the passive server takes over the active's IP address and resumes service. Active-passive failover can also be referred to as master-slave failover. Heartbeat application take care of the activation of the passive server when active is dead for any reason and keeps running passive until active is not recovered.
Active-active
In active-active, both servers are managing traffic, spreading the load between them.
If the servers are public-facing, the DNS would need to know about the public IPs of both servers. If the servers are internal-facing, application logic would need to know about both servers.
Active-active failover can also be referred to as master-master failover.
A content delivery network (CDN) is a globally distributed network of proxy servers, serving content from locations closer to the user. Generally, static files such as HTML/CSS/JS, photos, and videos are served from CDN.
Comments
Post a Comment