Skip to main content

System Design

Distributed systems' characteristics

  • Horizontal scaling: add more servers
  • Vertical scaling: upgrading hardware of the existing server (add more resources)

Reliability: a reliable system continues to function correctly even when some of the components fail

Availability: the percentage of time a system remains operational

Efficiency measured by two factors:

  1. Latency: Delay in first response
  2. Throughput: Numer of operations handled in a time unit

CAP Theorem: ?

Load balancer distributes incoming requests across multiple servers

Caching (cache)

Caching takes advantage of the principle that recently requested data is likely to be requested again. Retrieving data from cache is faster than from the database.

Content Delivery Network (CDN) ideal for serving static medias. CDS server cache contents, rồi nó dùng CDN gần nhất với location user để send response to reduce latency.

The challenge of cache is maintain data consistency and making sure data is in sync. We don't want to serve data from cache if it's not up-to-date with the database. We can use multiple Cache Invalidation Strategies.

Web server vs Application server

The client-server architecture is the underlying mechanism of the internet. When you visit a website or application, your browser (as the client) requests data from a remote server and displays the response.

A web server is a software component that delivers static data like images, files, and text in response to client requests. An application server adds business logic to compute the web server's response. Both terms are used synonymously, and the most popular server software solutions today are hybrid web-application servers.

Ngoài ra còn có Database server

Each Spring Boot web application includes an embedded web server (default is Tomcat).