Giter Club home page Giter Club logo

system-design-2's Introduction

Introduction

I summarize what I learnt about System Design in this gitbook.

Reference:

Topics

EVERYTHING IS A TRADE-OFF

  • Horizontal Scaling vs Vertical Scaling
  • Cache
  • Load Balancing
  • Database replication
  • Database partitioning

Get Started

  • Scalability Lecture at Harvard the best part I think is from 1:24:53
  • Scalability article
    • Load Balancer + Clones:
      • Purpose: More concurrent requests.
      • HowTo: Stateless Server. Centralized data store for session data (external DB or external persistent cache)
    • Database scaling:
      • Purpose: Resolve the query slowness caused by too many data.
      • HowTo: Sharding / Denormalization (include no more joins in any database query).
    • Cache:
      • Purpose: Improve read performance.
      • HowTo: in-memory cache like Memcached or Redis.
      • Patterns:
        1. Cached Database Queries. A hashed version of query is the cache key.

          Issue: Expiration. When one piece of data changes, you need to delete all cached queries which may include that data.

        2. Cached Objects.

    • Asynchronism:
      • Purpose: don't have to wait and occupy resource.
      • Paradigms:
        • Do expensive work beforehand. Example: dynamic content to static content.
        • Task/Message Queue

Performance vs scalability

A service is scalable if it results in increased performance in a manner proportional to resources added. Generally, increasing performance means serving more units of work, but it can also be to handle larger units of work, such as when datasets grow.1

Another way to look at 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.

Latency vs throughput

Latency is the time to perform some action or to produce some result.

Throughput is the number of such actions or results per unit of time.

Generally, you should aim for maximal throughput with acceptable latency.

Availability vs consistency

CAP theorem

system-design-2's People

Contributors

lzl124631x avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.