mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-03-12 17:51:53 +08:00
chore: sync content to repo (#9668)
Co-authored-by: kamranahmedse <4921183+kamranahmedse@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b034c1d89a
commit
2c28823466
@@ -10,10 +10,16 @@ The application is responsible for reading and writing from storage. The cache d
|
||||
|
||||
* Return entry
|
||||
|
||||
def get\_user(self, user\_id): user = cache.get("user.{0}", user\_id) if user is None: user = db.query("SELECT \* FROM users WHERE user\_id = {0}", user\_id) if user is not None: key = "user.{0}".format(user\_id) cache.set(key, json.dumps(user)) return user
|
||||
def get_user(self, user_id):
|
||||
user = cache.get("user.{0}", user_id)
|
||||
if user is None:
|
||||
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
||||
if user is not None:
|
||||
key = "user.{0}".format(user_id)
|
||||
cache.set(key, json.dumps(user))
|
||||
return user
|
||||
|
||||
|
||||
[Memcached](https://memcached.org/) is generally used in this manner. Subsequent reads of data added to cache are fast. Cache-aside is also referred to as lazy loading. Only requested data is cached, which avoids filling up the cache with data that isn't requested.
|
||||
[Memcached](https://memcached.org/) is generally used in this manner. Subsequent reads of data added to cache are fast. Cache-aside is also referred to as lazy loading. Only the requested data is cached, which avoids filling up the cache with data that isn't requested.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@ DNS is hierarchical, with a few authoritative servers at the top level. Your rou
|
||||
|
||||
Services such as [CloudFlare](https://www.cloudflare.com/dns/) and [Route53](https://aws.amazon.com/route53/) provide managed DNS services. Some DNS services can route traffic through various methods:
|
||||
|
||||
* [@article@Weighted Round Robin](https://www.jscape.com/blog/load-balancing-algorithms)
|
||||
* Prevent traffic from going to servers under maintenance
|
||||
* Balance between varying cluster sizes
|
||||
* A/B testing
|
||||
* [@article@Latency Based](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-latency)
|
||||
* [@article@Geolocation Based](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-geo)
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@opensource@Getting started with Domain Name System](https://github.com/donnemartin/system-design-primer#domain-name-system)
|
||||
- [@article@What is DNS?](https://www.cloudflare.com/learning/dns/what-is-dns/)
|
||||
- [@article@What is DNS?](https://www.cloudflare.com/learning/dns/what-is-dns/)
|
||||
- [@article@Latency Based](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-latency)
|
||||
- [@article@Geolocation Based](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-geo)
|
||||
- [@article@Weighted Round Robin](https://www.jscape.com/blog/load-balancing-algorithms)
|
||||
@@ -7,11 +7,6 @@ Message queues receive, hold, and deliver messages. If an operation is too slow
|
||||
|
||||
The user is not blocked and the job is processed in the background. During this time, the client might optionally do a small amount of processing to make it seem like the task has completed. For example, if posting a tweet, the tweet could be instantly posted to your timeline, but it could take some time before your tweet is actually delivered to all of your followers.
|
||||
|
||||
* [@article@Redis](https://redis.io/) is useful as a simple message broker but messages can be lost.
|
||||
* [@article@RabbitMQ](https://www.rabbitmq.com/) is popular but requires you to adapt to the 'AMQP' protocol and manage your own nodes.
|
||||
* [@article@AWS SQS](https://aws.amazon.com/sqs/) is hosted but can have high latency and has the possibility of messages being delivered twice.
|
||||
* [@article@Apache Kafka](https://kafka.apache.org/) is a distributed event store and stream-processing platform.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@article@What is Redis?](https://redis.io/)
|
||||
|
||||
@@ -4,7 +4,7 @@ SQL databases, such as MySQL and PostgreSQL, are best suited for structured, rel
|
||||
|
||||
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.
|
||||
|
||||
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, a 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.
|
||||
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.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
# TCP
|
||||
|
||||
TCP is a connection-oriented protocol over an [IP network](https://en.wikipedia.org/wiki/Internet_Protocol). Connection is established and terminated using a [handshake](https://en.wikipedia.org/wiki/Handshaking). All packets sent are guaranteed to reach the destination in the original order and without corruption through:
|
||||
|
||||
* Sequence numbers and [checksum fields](https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Checksum_computation) for each packet
|
||||
* [@article@Acknowledgement](https://en.wikipedia.org/wiki/Acknowledgement_\(data_networks\)) packets and automatic retransmission
|
||||
|
||||
If the sender does not receive a correct response, it will resend the packets. If there are multiple timeouts, the connection is dropped. TCP also implements [flow control](https://en.wikipedia.org/wiki/Flow_control_\(data\)) and congestion control. These guarantees cause delays and generally result in less efficient transmission than UDP.
|
||||
|
||||
To ensure high throughput, web servers can keep a large number of TCP connections open, resulting in high memory usage. It can be expensive to have a large number of open connections between web server threads and say, a [memcached server](https://memcached.org/). [Connection pooling](https://en.wikipedia.org/wiki/Connection_pool) can help in addition to switching to UDP where applicable.
|
||||
|
||||
TCP is useful for applications that require high reliability but are less time critical. Some examples include web servers, database info, SMTP, FTP, and SSH.
|
||||
|
||||
Use TCP over UDP when:
|
||||
|
||||
* You need all of the data to arrive intact
|
||||
* You want to automatically make a best estimate use of the network throughput
|
||||
TCP (Transmission Control Protocol) is a connection-oriented, reliable, and ordered protocol used for transmitting data over an IP network. It establishes a connection between a sender and receiver before data transfer begins, ensures that data packets arrive in the correct sequence without errors, and provides mechanisms for retransmission of lost packets and flow control to manage network congestion.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user