Mcrouter là gì? Dùng McRouter scale out Memcache cho giải pháp Microservices

Tram Ho

Mcrouter đóng vai trò là một router cho các services memcache. Đây là một thành phần trong cơ sở hạ tầng cache tại Facebook và Instagram, nơi xử lý gần 5 tỷ yêu cầu mỗi giây. Mcrouter được phát triển và duy trì bởi Facebook.

Hướng dẫn cài đặt

Xem tài liệu này: https://github.com/facebook/mcrouter

Sharded pools setup

Viết file setup vào file json
Sau đó chạy lệnh:
mcrouter file.json -p port(s) -f config
Memcached protocol router for scaling memcached deployments with:

  • Multiple hashing schemas -> hash table
  • Multi-cluster support

  • Prefix routing -> config with json
  • Flexible routing -> config with json

Explanation: requests with key prefix “a” will be sent to pool ‘workload1’, requests with key prefix “b” will be sent to pool ‘workload2’, requests with key prefix “ab” will be sent to pool ‘workload3’. Other requests will be sent to pool ‘common_cache’. So key “acd” will be sent to ‘workload1’; “abcd” to ‘workload3’; “bar” to ‘workload2’; “zzz” to ‘common_cache’.

  • Sharded pools

  • Replicated pools

Note: number of retries is 5.

  • Broadcast operations
  • Production traffic shadowing

  • Cold cache warm up

  • **Memcached ASCII protocol **
  • Reliable delete stream
  • Large values
  • Muti-level caches
  • Quality of service
  • Destination health monitoring/automatic failover
  • Rich stats counters, Stats commands and debug commands
  • Online reconfiguration
  • Ipv6 support
  • SSL support
Chia sẻ bài viết ngay

Nguồn bài viết : Viblo