Load Balancers & Caches

Load Balancers & Caches

What is Load Balancer?

Load Balancer evenly distributes incoming traffic/load among webservers/workers that are defined in a load-balanced set. Users connect to the public IP of the load balancer, and web-servers are reachable over private IP from load balancer. Ex: Ngnix, Amazon ELB

If Web-Server1 goes offline, all the traffic will be routed to Web-Server2. This prevents the website from going offline. If the website traffic grows rapidly, and two servers are not enough to handle the traffic, new web servers can be added to pool

Types of LB

Places where LB can be kept

Scheduling Algorithms for LB

What is Cache?

Cache is temporary storage that stores the result of frequently accessed data in memory so that subsequent requests are served more quickly What data should be cached? Mostly used, less frequently changing data is stored in cache. (Eg: Metadata, configuration data) What should not be cached? Data that is frequently/actively changing. Cache lies near to requester so that requester need not to go hard-disk to retrieve data. This reduces latency.

Types of Caches

Where Caches can be placed?

1. Web Browser Cache

Browser stores local copies of web resources for faster retrieval the next time on Hard-disk. Ex: Once browser downloads CSS, JS files, images (for a session) there is no need again to download from same server and can be cached

CACHE-CONTROL HEADER: HTTP server instructs browser(http client) to cache a particular content for TTL duration in cache control header. Format: Response Header {cache-control: public, max-age: 45223}

2. Between Application Server and Database

Cache Between AppServer & DB

Cache Eviction Policies

No eviction returning an error the memory limit is reached All keys LRU removing keys by the least recently used first Volatile LRU removing keys, that have an expiration time set, by the least recently used first. All keys random removing keys randomly Volatile random removing keys, that have an expiration time set, randomly Volatile TTL removing keys, that have an expiration time set, by the shortest time to live first.

Redis vs Memcached


要查看或添加评论,请登录

Amit K.的更多文章

  • Pyunit or Unitest

    Pyunit or Unitest

    Used to test a unit of source code Features: 1. PyUnit is very simple yet very flexible 2.

  • Calling OpenAI APIs from code

    Calling OpenAI APIs from code

    Steps a. Get openAI API Key openaAI API Key b.

    3 条评论
  • FlatList with Example in React Native

    FlatList with Example in React Native

    What is FlatList? displays a scrolling list of changing, but similarly structured, data. Unlike the more generic…

  • Create Postgres Database, Tables, Schema using Diesel(ORM) Rust

    Create Postgres Database, Tables, Schema using Diesel(ORM) Rust

    What is Diesel Diesel is a ORM(object-relational mapping). ORM is programming technique that connects object-oriented…

  • Location Sharing App System Design (Bump)

    Location Sharing App System Design (Bump)

    What is Bump Bump is location sharing Mobile App. Install bump on 2 phones(add as friends).

  • REST API / Representation State Transfer

    REST API / Representation State Transfer

    Restful Web Server/Application? Web application that implements HTTP CRUD methods in Restful way. Eg: Twitter, facebook…

  • Inter Thread Communication in Rust using Channels

    Inter Thread Communication in Rust using Channels

    What is Channel? Sender and Receiver are connected via Channel. They can send/recv data via channel.

  • Slices in Rust

    Slices in Rust

    What is Slice Slice is somepart of larger data, it always borrow data(Hence RO) from the sliced type. It gives you a…

  • Traits in Rust

    Traits in Rust

    What is Triat in Rust Interface/class in Rust(declared with keyword trait) having Virtual Functions(not pure Virtual)…

  • Facebook News Feed High Level System Design

    Facebook News Feed High Level System Design

    HLD Json Web Token / oauth_token / auth_token based authentication to Facebook GET Newsfeed What we will do? We will…

社区洞察

其他会员也浏览了