parent
ca35551e4f
commit
59ed243fa7
24 changed files with 79 additions and 124 deletions
@ -1,8 +1,3 @@ |
||||
# Layer 4 Load Balancing |
||||
|
||||
Layer 4 load balancers look at info at the transport layer to decide how to distribute requests. Generally, this involves the source, destination IP addresses, and ports in the header, but not the contents of the packet. Layer 4 load balancers forward network packets to and from the upstream server, performing Network Address Translation (NAT). |
||||
|
||||
To learn more, visit the following links: |
||||
|
||||
- [What is Layer 4 Load Balancing?](https://github.com/donnemartin/system-design-primer#communication) |
||||
- [Getting Started with Layer 4 Load Balancing](https://www.nginx.com/resources/glossary/layer-4-load-balancing/) |
@ -1,8 +1,9 @@ |
||||
# Load Balancing Algorithms |
||||
|
||||
Load balancing is the process of distributing incoming network traffic across multiple servers in order to optimize resource usage, minimize response time, and avoid overloading any single server. There are several algorithms that can be used to achieve this, each with its own advantages and disadvantages. |
||||
A load balancer is a software or hardware device that keeps any one server from becoming overloaded. A load balancing algorithm is the logic that a load balancer uses to distribute network traffic between servers (an algorithm is a set of predefined rules). |
||||
|
||||
There are two primary approaches to load balancing. Dynamic load balancing uses algorithms that take into account the current state of each server and distribute traffic accordingly. Static load balancing distributes traffic without making these adjustments. Some static algorithms send an equal amount of traffic to each server in a group, either in a specified order or at random. |
||||
|
||||
To learn more, visit the following links: |
||||
|
||||
- [Concept of load balancing algorithms](https://www.enjoyalgorithms.com/blog/load-balancers-in-system-design) |
||||
- [Types of load balancing algorithms](https://www.cloudflare.com/learning/performance/types-of-load-balancing-algorithms/) |
||||
- [Types of Load Balancing Algorithms](https://www.cloudflare.com/learning/performance/types-of-load-balancing-algorithms/) |
@ -1,10 +1,10 @@ |
||||
# Microservices |
||||
|
||||
Related to this discussion are microservices, which can be described as a suite of independently deployable, small, modular services. Each service runs a unique process and communicates through a well-defined, lightweight mechanism to serve a business goal. 1 |
||||
Related to the "Application Layer" discussion are microservices, which can be described as a suite of independently deployable, small, modular services. Each service runs a unique process and communicates through a well-defined, lightweight mechanism to serve a business goal. 1 |
||||
|
||||
Pinterest, for example, could have the following microservices: user profile, follower, feed, search, photo upload, etc. |
||||
|
||||
To learn more, visit the following links: |
||||
|
||||
- [Intro to Microservice](https://github.com/donnemartin/system-design-primer#microservices) |
||||
- [Building Microservices](https://cloudncode.wordpress.com/2016/07/22/msa-getting-started/) |
||||
- [Introduction to Microservices](https://aws.amazon.com/microservices/) |
||||
- [Microservices - Wikipedia](https://en.wikipedia.org/wiki/Microservices) |
@ -1,11 +1,11 @@ |
||||
# Replication |
||||
|
||||
## Master-slave replication: |
||||
The master serves reads and writes, replicating writes to one or more slaves, which serve only reads. Slaves can also replicate to additional slaves in a tree-like fashion. If the master goes offline, the system can continue to operate in read-only mode until a slave is promoted to a master or a new master is provisioned. |
||||
Replication is the process of copying data from one database to another. Replication is used to increase availability and scalability of databases. There are two types of replication: master-slave and master-master. |
||||
|
||||
## Master-master replication: |
||||
Both masters serve reads and writes and coordinate with each other on writes. If either master goes down, the system can continue to operate with both reads and writes. |
||||
## Master-slave Replication: |
||||
|
||||
To learn more, visit the following links: |
||||
The master serves reads and writes, replicating writes to one or more slaves, which serve only reads. Slaves can also replicate to additional slaves in a tree-like fashion. If the master goes offline, the system can continue to operate in read-only mode until a slave is promoted to a master or a new master is provisioned. |
||||
|
||||
- [Getting started with Replication](https://github.com/donnemartin/system-design-primer#replication) |
||||
## Master-master Replication: |
||||
|
||||
Both masters serve reads and writes and coordinate with each other on writes. If either master goes down, the system can continue to operate with both reads and writes. |
@ -1,7 +1,3 @@ |
||||
# Federation |
||||
|
||||
Federation (or functional partitioning) splits up databases by function. For example, instead of a single, monolithic database, you could have three databases: forums, users, and products, resulting in less read and write traffic to each database and therefore less replication lag. Smaller databases result in more data that can fit in memory, which in turn results in more cache hits due to improved cache locality. With no single central master serializing writes you can write in parallel, increasing throughput. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [Intro to Federation](https://github.com/donnemartin/system-design-primer#federation) |
@ -1,32 +1,12 @@ |
||||
# SQL vs noSQL |
||||
|
||||
## Reasons for SQL: |
||||
- Structured data |
||||
- Strict schema |
||||
- Relational data |
||||
- Need for complex joins |
||||
- Transactions |
||||
- Clear patterns for scaling |
||||
- More established: developers, community, code, tools, etc |
||||
- Lookups by index are very fast |
||||
SQL databases, such as MySQL and PostgreSQL, are best suited for structured, relational data and use a fixed schema. They provide robust ACID (Atomicity, Consistency, Isolation, Durability) transactions and support complex queries and joins. |
||||
|
||||
NoSQL databases, such as MongoDB and Cassandra, are best suited for unstructured, non-relational data and use a flexible schema. They provide high scalability and performance for large amounts of data and are often used in big data and real-time web applications. |
||||
|
||||
## Reasons for NoSQL: |
||||
- Semi-structured data |
||||
- Dynamic or flexible schema |
||||
- Non-relational data |
||||
- No need for complex joins |
||||
- Store many TB (or PB) of data |
||||
- Very data intensive workload |
||||
- Very high throughput for IOPS |
||||
The choice between SQL and NoSQL depends on the specific use case and requirements of the project. If you need to store and query structured data with complex relationships, an SQL database is likely a better choice. If you need to store and query large amounts of unstructured data with high scalability and performance, a NoSQL database may be a better choice. |
||||
|
||||
## Sample data well-suited for NoSQL: |
||||
- Rapid ingest of clickstream and log data |
||||
- Leaderboard or scoring data |
||||
- Temporary data, such as a shopping cart |
||||
- Frequently accessed ('hot') tables |
||||
- Metadata/lookup tables |
||||
|
||||
Learn more from the followinw links: |
||||
- [SQL vs NoSQL: The Differences](https://www.sitepoint.com/sql-vs-nosql-differences/) |
||||
- [Scaling up to your first 10 million users](https://www.youtube.com/watch?v=kKjm4ehYiMs) |
||||
- [SQL vs NoSQL - When to Use Each](https://www.ibm.com/cloud/blog/sql-vs-nosql) |
@ -1,15 +1,13 @@ |
||||
# Databases |
||||
|
||||
A database is a collection of data that is organized and stored in a structured way, allowing for efficient retrieval and manipulation of the data. Databases are used in many different types of systems to store and manage data, from small personal applications to large enterprise systems. |
||||
Picking the right database for a system is an important decision, as it can have a significant impact on the performance, scalability, and overall success of the system. Some of the key reasons why it's important to pick the right database include: |
||||
|
||||
There are many different types of databases available, each with their own strengths and weaknesses. Some of the most common types of databases are: |
||||
- Performance: Different databases have different performance characteristics, and choosing the wrong one can lead to poor performance and slow response times. |
||||
- Scalability: As the system grows and the volume of data increases, the database needs to be able to scale accordingly. Some databases are better suited for handling large amounts of data than others. |
||||
- Data Modeling: Different databases have different data modeling capabilities and choosing the right one can help to keep the data consistent and organized. |
||||
- Data Integrity: Different databases have different capabilities for maintaining data integrity, such as enforcing constraints, and can have different levels of data security. |
||||
- Support and maintenance: Some databases have more active communities and better documentation, making it easier to find help and resources. |
||||
|
||||
- Relational databases |
||||
- NoSQL databases |
||||
- Graph databases |
||||
- Time-series databases |
||||
Overall, by choosing the right database, you can ensure that your system will perform well, scale as needed, and be maintainable in the long run. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [Intro to Databases](https://github.com/donnemartin/system-design-primer#database) |
||||
- [Database design](https://en.wikipedia.org/wiki/Database_design) |
||||
- [Scaling up to your first 10 million users](https://www.youtube.com/watch?v=kKjm4ehYiMs) |
||||
|
Loading…
Reference in new issue