Skip to content
main
Switch branches/tags
Code

Latest commit

…Route

Summary:
Use ThreadWheelTimekeeperHighRes(tick interval: 200us) instead of the default wheel timer.(tick interval: 10ms)

Problem:
The default HHWheelTimer has tick interval as 10 ms. The resolution doesn't work for us. We want to inject latency < 10ms.

This is what we got when use 10ms resolution:

    // No latency injection:
    // 7484443ns
    // 2895072ns
    // 2272623ns
    // 2116943ns
    // 2352050ns
    // 2184571ns
    // 2155058ns
    // 2190798ns
    // 2277108ns
    // 2146663ns

    // inject 1us
    // 13356675ns
    // 13570404ns
    // 13502320ns
    // 13884079ns
    // 13633347ns
    // 14344280ns
    // 24118279ns
    // 14239026ns
    // 15562335ns
    // 13824822ns

    // inject 500us
    // 13845892ns
    // 13729600ns
    // 13675538ns
    // 13300982ns
    // 13519858ns
    // 13641474ns
    // 13379810ns
    // 13631860ns
    // 13575390ns
    // 13412290ns

This is when use ThreadWheelTimekeeperHighRes:
```
//No latency injection:
// 3795982ns
// 2475935ns
// 2340193ns
// 5906704ns
// 2341297ns
// 2259881ns
// 2378804ns
// 2196142ns
// 2236368ns
// 2162909ns
// inject 500us
// 3434569ns
// 3331454ns
// 3523328ns
// 3161830ns
// 3283122ns
// 3434077ns
// 3306027ns
// 3199578ns
// 3173209ns
// 3331762ns
// inject 1ms
// 3947348ns
// 5826891ns
// 3853759ns
// 4544190ns
// 3665137ns
// 3629669ns
// 15211075ns
// 29745603ns
// 5162278ns
// 4143592ns
// inject 2ms
// 4945852ns
// 4878179ns
// 4911360ns
// 4658311ns
// 4906388ns
// 4830594ns
// 4807753ns
// 4905038ns
// 4846645ns
// 5077264ns

Reviewed By: aptxkid

Differential Revision: D31760814

fbshipit-source-id: 38ce7cc40a525c9ffb34fa665cc675acc15f0b86
a58857f

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Mcrouter Build Status

License

Mcrouter (pronounced mc router) is a memcached protocol router for scaling memcached deployments. It's a core component of cache infrastructure at Facebook and Instagram where mcrouter handles almost 5 billion requests per second at peak.

Mcrouter is developed and maintained by Facebook.

See https://github.com/facebook/mcrouter/wiki to get started.

Quick start guide

New! Ubuntu package available

Currently, we support Ubuntu Bionic (18.04) amd64. Here is how to install it:

Add the repo key:

$ wget -O - https://facebook.github.io/mcrouter/debrepo/bionic/PUBLIC.KEY | sudo apt-key add

Add the following line to apt sources file /etc/apt/sources.list

deb https://facebook.github.io/mcrouter/debrepo/bionic bionic contrib

Update the local repo cache:

$ sudo apt-get update

Install mcrouter:

$ sudo apt-get install mcrouter

Installing From Source

See https://github.com/facebook/mcrouter/wiki/mcrouter-installation for more detailed installation instructions.

Mcrouter depends on folly, wangle, fizz, and fbthrift.

The installation is a standard autotools flow:

$ autoreconf --install
$ ./configure
$ make
$ sudo make install
$ mcrouter --help

Assuming you have a memcached instance on the local host running on port 5001, the simplest mcrouter setup is:

$ mcrouter \
    --config-str='{"pools":{"A":{"servers":["127.0.0.1:5001"]}},
                  "route":"PoolRoute|A"}' \
    -p 5000
$ echo -ne "get key\r\n" | nc 0 5000

(nc is the GNU Netcat, http://netcat.sourceforge.net/)

Features

  • Memcached ASCII protocol
  • Connection pooling
  • Multiple hashing schemes
  • Prefix routing
  • Replicated pools
  • Production traffic shadowing
  • Online reconfiguration
  • Flexible routing
  • Destination health monitoring/automatic failover
  • Cold cache warm up
  • Broadcast operations
  • Reliable delete stream
  • Multi-cluster support
  • Rich stats and debug commands
  • Quality of service
  • Large values
  • Multi-level caches
  • IPv6 support
  • SSL support

Links

Documentation: https://github.com/facebook/mcrouter/wiki Engineering discussions and support: https://www.facebook.com/groups/mcrouter

License

Copyright (c) Facebook, Inc. and its affiliates.

Licensed under the MIT license: https://github.com/facebook/mcrouter/blob/master/LICENSE