Twemcache 是 Twitter 对 memcached 的改造版本。Twemcache 基于 memcached 1.4.4,Twitter 对其改造使之更适合大规模的 Twitter 产品环境。
特征:
编译安装:
1. 从分发包中构建
$ ./configure $ make $ sudo make install
2. 使用非标准路径的 libevent 来构建 twemcache
$ ./configure --with-libevent=<path> $ make $ sudo make install
3. 使用 libevent 静态链接库构建 twemcache
$ ./configure --enable-static=libevent $ make $ sudo make install
4. 使用调试和诊断模式构建
$ CFLAGS="-ggdb3 -O0" ./configure --enable-debug=full $ make $ sudo make install
5. 启用调试模式,禁用诊断模式的构建
$ git clone git@github.com:twitter/twemcache.git $ cd twemcache $ autoreconf -fvi $ ./configure --enable-debug=log $ make V=1 $ src/twemcache -h
完整命令行说明
Usage: twemcache [-?hVCELdkrDS] [-o output file] [-v verbosity level] [-A stats aggr interval] [-t threads] [-P pid file] [-u user] [-x command logging entry] [-X command logging file] [-R max requests] [-c max conns] [-b backlog] [-p port] [-U udp port] [-l interface] [-s unix path] [-a access mask] [-M eviction strategy] [-f factor] [-m max memory] [-n min item chunk size] [-I slab size] [-z slab profile] Options: -h, --help : this help -V, --version : show version and exit -E, --prealloc : preallocate memory for all slabs -L, --use-large-pages : use large pages if available -k, --lock-pages : lock all pages and preallocate slab memory -d, --daemonize : run as a daemon -r, --maximize-core-limit : maximize core file limit -C, --disable-cas : disable use of cas -D, --describe-stats : print stats description and exit -S, --show-sizes : print slab and item struct sizes and exit -o, --output=S : set the logging file (default: stderr) -v, --verbosity=N : set the logging level (default: 5, min: 0, max: 11) -A, --stats-aggr-interval=N : set the stats aggregation interval in usec (default: 100000 usec) -t, --threads=N : set number of threads to use (default: 4) -P, --pidfile=S : set the pid file (default: off) -u, --user=S : set user identity when run as root (default: off) -x, --klog-entry=N : set the command logging entry number per thread (default: 512) -X, --klog-file=S : set the command logging file (default: off) -R, --max-requests=N : set the maximum number of requests per event (default: 20) -c, --max-conns=N : set the maximum simultaneous connections (default: 1024) -b, --backlog=N : set the backlog queue limit (default 1024) -p, --port=N : set the tcp port to listen on (default: 11211) -U, --udp-port=N : set the udp port to listen on (default: 11211) -l, --interface=S : set the interface to listen on (default: all) -s, --unix-path=S : set the unix socket path to listen on (default: off) -a, --access-mask=O : set the access mask for unix socket in octal (default: 0700) -M, --eviction-strategy=N : set the eviction strategy on OOM (default: 2, random) -f, --factor=D : set the growth factor of slab item sizes (default: 1.25) -m, --max-memory=N : set the maximum memory to use for all items in MB (default: 64 MB) -n, --min-item-chunk-size=N : set the minimum item chunk size in bytes (default: 72 bytes) -I, --slab-size=N : set slab size in bytes (default: 1048576 bytes) -z, --slab-profile=S : set the profile of slab item chunk sizes (default: off)
安装完后你可以使用 twctop.rb 这个工具来测试它的性能。
本文中的所有译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接。 2KB翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。2KB项目(www.2kb.com,源码交易平台),提供担保交易、源码交易、虚拟商品、在家创业、在线创业、任务交易、网站设计、软件设计、网络兼职、站长交易、域名交易、链接买卖、网站交易、广告买卖、站长培训、建站美工等服务