• This repository has been archived on 18/Sep/2021
  • Stars
    star
    242
  • Rank 161,551 (Top 4 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created over 12 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool for measuring memcached server performance

twemperf (mcperf)

twemperf (pronounced "two-em-perf"), aka mcperf is a tool for measuring memcached server performance. mcperf is like httperf, but for memcached protocol. It speaks memcached ASCII protocol and is capable of generating connections and requests at a high rate.

Building mcperf

To build mcperf from distribution tarball:

$ ./configure
$ make
$ sudo make install

To build mcperf from distribution tarball in debug mode:

$ CFLAGS="-ggdb3 -O0" ./configure --enable-debug
$ make
$ sudo make install

To build mcperf from source in debug mode:

$ git clone git://github.com/twitter/twemperf.git
$ cd twemperf
$ autoreconf -fvi
$ CFLAGS="-ggdb3 -O0" ./configure --enable-debug
$ make
$ src/mcperf -h

Help

Usage: mcperf [-?hV] [-v verbosity level] [-o output file]
              [-s server] [-p port] [-H] [-t timeout] [-l linger]
              [-b send-buffer] [-B recv-buffer] [-D]
              [-m method] [-e expiry] [-q] [-P prefix]
              [-c client] [-n num-conns] [-N num-calls]
              [-r conn-rate] [-R call-rate] [-z sizes]

Options:
  -h, --help            : this help
  -V, --version         : show version and exit
  -v, --verbosity=N     : set logging level (default: 5, min: 0, max: 11)
  -o, --output=S        : set logging file (default: stderr)
  -s, --server=S        : set the hostname of the server (default: localhost)
  -p, --port=N          : set the port number of the server (default: 11211)
  -H, --print-histogram : print response time histogram
  ...
  -t, --timeout=X       : set the connection and response timeout in sec (default: 0.0 sec)
  -l, --linger=N        : set the linger timeout in sec, when closing TCP connections (default: off)
  -b, --send-buffer=N   : set socket send buffer size (default: 4096 bytes)
  -B, --recv-buffer=N   : set socket recv buffer size (default: 16384 bytes)
  -D, --disable-nodelay : disable tcp nodelay
  ...
  -m, --method=M        : set the method to use when issuing memcached request (default: set)
  -e, --expiry=N        : set the expiry value in sec for generated requests (default: 0 sec)
  -q, --use-noreply     : set noreply for generated requests
  -P, --prefix=S        : set the prefix of generated keys (default: mcp:)
  ...
  -c, --client=I/N      : set mcperf instance to be I out of total N instances (default: 0/1)
  -n, --num-conns=N     : set the number of connections to create (default: 1)
  -N, --num-calls=N     : set the number of calls to create on each connection (default: 1)
  -r, --conn-rate=R     : set the connection creation rate (default: 0 conns/sec)
  -R, --call-rate=R     : set the call creation rate (default: 0 calls/sec)
  -z, --sizes=R         : set the distribution for item sizes (default: d1 bytes)
  ...
Where:
  N is an integer
  X is a real
  S is a string
  M is a method string and is either a 'get', 'gets', 'delete', 'cas', 'set', 'add', 'replace'
  'append', 'prepend', 'incr', 'decr'
  R is the rate written as [D]R1[,R2] where:
  D is the distribution type and is either deterministic 'd', uniform 'u', or exponential 'e' and if:
  D is ommited or set to 'd', a deterministic interval specified by parameter R1 is used
  D is set to 'e', an exponential distibution with mean interval of R1 is used
  D is set to 'u', a uniform distribution over interval [R1, R2) is used
  R is 0, the next request or connection is created after the previous one completes

Design

  1. Single threaded.
  2. Asynchronous I/O through non-blocking sockets and Linux epoll(7) syscall.
  3. Horizonal scaling through many concurrent mcperf processes on several different machines.

mcperf is composed of three main subsystems:

  1. Core Engine
  2. Load Generator
  3. Stats Collector

The core engine is responsible for the event handling and parsing of memcached protocol and drives the main event loop.

The load generator is resposible for generating load either periodically or as a one-shot event. Each load generator is implemented as a self contained module. Some examples of load generators are:

  1. Connection generator creates connections to a server at a given rate.
  2. Call generator issue calls (requests) on a connection at a given rate.
  3. Size generator generates item sizes.

The stats collector is responsible for collecting statistics. Each stats collector is implemented as a self contained module. Some examples of stats collectors are:

  1. Connection stats collects connection stats.
  2. Call stats collects call (request and response) stats.

Examples

The following example creates 1000 connections to a memcached server running on localhost:11211. The connections are created at the rate of 1000 conns/sec and on every connection it sends 10 'set' requests at the rate of 1000 reqs/sec with the item sizes derived from a uniform distribution in the interval of [1,16) bytes.

$ mcperf --linger=0 --timeout=5 --conn-rate=1000 --call-rate=1000 --num-calls=10 --num-conns=1000 --sizes=u1,16

Total: connections 1000 requests 10000 responses 10000 test-duration 1.009 s

Connection rate: 991.1 conn/s (1.0 ms/conn <= 23 concurrent connections)
Connection time [ms]: avg 10.3 min 10.1 max 14.1 stddev 0.1
Connect time [ms]: avg 0.2 min 0.1 max 0.8 stddev 0.0

Request rate: 9910.5 req/s (0.1 ms/req)
Request size [B]: avg 35.9 min 28.0 max 44.0 stddev 4.8

Response rate: 9910.5 rsp/s (0.1 ms/rsp)
Response size [B]: avg 8.0 min 8.0 max 8.0 stddev 0.0
Response time [ms]: avg 0.2 min 0.1 max 13.4 stddev 0.00
Response time [ms]: p25 1.0 p50 1.0 p75 1.0
Response time [ms]: p95 1.0 p99 1.0 p999 1.0
Response type: stored 10000 not_stored 0 exists 0 not_found 0
Response type: num 0 deleted 0 end 0 value 0
Response type: error 0 client_error 0 server_error 0

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 ftab-full 0 addrunavail 0 other 0

CPU time [s]: user 0.64 system 0.35 (user 63.6% system 35.1% total 98.7%)
Net I/O: bytes 428.7 KB rate 424.8 KB/s (3.5*10^6 bps)

The following example creates 100 connections to a memcached server running on localhost:11211. Every connection is created after the previous connection is closed. On every connection we send 100 'set' requests and every request is created after we have received the response for the previous request. All the set requests generated have a fixed item size of 1 byte.

$ mcperf --linger=0 --call-rate=0 --num-calls=100 --conn-rate=0 --num-conns=100 --sizes=d1

Total: connections 100 requests 10000 responses 10000 test-duration 1.268 s

Connection rate: 78.9 conn/s (12.7 ms/conn <= 1 concurrent connections)
Connection time [ms]: avg 12.7 min 12.6 max 13.5 stddev 0.1
Connect time [ms]: avg 0.0 min 0.0 max 0.1 stddev 0.0

Request rate: 7886.1 req/s (0.1 ms/req)
Request size [B]: avg 28.0 min 28.0 max 28.0 stddev 0.0

Response rate: 7886.1 rsp/s (0.1 ms/rsp)
Response size [B]: avg 8.0 min 8.0 max 8.0 stddev 0.0
Response time [ms]: avg 0.1 min 0.1 max 1.0 stddev 0.00
Response time [ms]: p25 1.0 p50 1.0 p75 1.0
Response time [ms]: p95 1.0 p99 1.0 p999 1.0
Response type: stored 10000 not_stored 0 exists 0 not_found 0
Response type: num 0 deleted 0 end 0 value 0
Response type: error 0 client_error 0 server_error 0

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 ftab-full 0 addrunavail 0 other 0

CPU time [s]: user 0.51 system 0.75 (user 40.0% system 59.0% total 99.0%)
Net I/O: bytes 351.6 KB rate 277.2 KB/s (2.3*10^6 bps)

Issues and Support

Have a bug or a question? Please create an issue here on GitHub!

https://github.com/twitter/twemperf/issues

Contributors

  • Manju Rajashekhar (@manju)
  • Clojure Janet (@clojurejanet)

More Repositories

1

snowflake

Snowflake is a network service for generating unique ID numbers at high scale with some simple guarantees.
Scala
7,566
star
2

diffy

Find potential bugs in your services with Diffy
Scala
3,827
star
3

flockdb

A distributed, fault-tolerant graph database
Scala
3,326
star
4

kestrel

simple, distributed message queue system (inactive)
Scala
2,780
star
5

twui

A UI framework for Mac based on Core Animation
Objective-C
2,750
star
6

CocoaSPDY

SPDY for iOS and OS X
Objective-C
2,396
star
7

gizzard

[Archived] A flexible sharding framework for creating eventually-consistent distributed datastores
Scala
2,255
star
8

distributedlog

A high performance replicated log service. (The development is moved to Apache Incubator)
Java
2,227
star
9

recess

A simple and attractive code quality tool for CSS built on top of LESS
CSS
2,190
star
10

commons

Twitter common libraries for python and the JVM (deprecated)
Java
2,102
star
11

iago

A load generator, built for engineers
Scala
1,351
star
12

twitter-text-js

A JavaScript implementation of Twitter's text processing library
1,212
star
13

ambrose

A platform for visualization and real-time monitoring of data workflows
Java
1,180
star
14

twitter-kit-android

Twitter Kit for Android
Java
827
star
15

ostrich

A stats collector & reporter for Scala servers (deprecated)
Scala
774
star
16

twitter-kit-ios

Twitter Kit is a native SDK to include Twitter content inside mobile apps.
Objective-C
684
star
17

twitter-text-rb

A library that does auto linking and extraction of usernames, lists and hashtags in tweets
617
star
18

mysos

Cotton (formerly known as Mysos)
592
star
19

twitter-text-objc

An Objective-C implementation of Twitter's text processing library
587
star
20

torch-autograd

Autograd automatically differentiates native Torch code
Lua
556
star
21

ospriet

An example audience moderation app built on Twitter
JavaScript
408
star
22

cloudhopper-smpp

Efficient, scalable, and flexible Java implementation of the Short Messaging Peer to Peer Protocol (SMPP)
Java
384
star
23

twitter-text-java

A Java implementation of Twitter's text processing library
363
star
24

jvmgcprof

A simple utility for profile allocation and garbage collection activity in the JVM
C
342
star
25

css-flip

A CSS BiDi flipper
JavaScript
313
star
26

clockworkraven

Human-Powered Data Analysis with Mechanical Turk
Ruby
299
star
27

torch-twrl

Torch-twrl is a package that enables reinforcement learning in Torch.
Lua
251
star
28

cassie

A Scala client for Cassandra
Scala
243
star
29

hdfs-du

Visualize your HDFS cluster usage
JavaScript
231
star
30

pycascading

A Python wrapper for Cascading
Python
223
star
31

RTLtextarea

Automatically detects RTL and configures a text input
JavaScript
170
star
32

haplocheirus

A Redis-backed storage engine for timelines
Scala
133
star
33

standard-project

A slightly more standard sbt project plugin library
Scala
132
star
34

torch-decisiontree

This project implements random forests and gradient boosted decision trees (GBDT). The latter uses gradient tree boosting. Both use ensemble learning to produce ensembles of decision trees (that is, forests).
Lua
125
star
35

torch-ipc

A set of primitives for parallel computation in Torch
C
96
star
36

elephant-twin

Elephant Twin is a framework for creating indexes in Hadoop
Java
96
star
37

torch-distlearn

A set of distributed learning algorithms for Torch
Lua
95
star
38

libcrunch

A lightweight mapping framework that maps data objects to a number of nodes, subject to constraints
Java
90
star
39

scribe

A Ruby client library for Scribe
Ruby
89
star
40

sbt-package-dist

sbt 11 plugin codifying best practices for building, packaging, and publishing
Scala
88
star
41

twisitor

A simple and spectacular photo-tweeting birdhouse
JavaScript
84
star
42

code-of-conduct

Open Source Code of Conduct at Twitter
83
star
43

flockdb-client

A Ruby client library for FlockDB
Ruby
83
star
44

twitter-text-conformance

Conformance testing data for the twitter-text-* repositories
77
star
45

torch-dataset

An extensible and high performance method of reading, sampling and processing data for Torch
Lua
77
star
46

naggati2

Protocol builder for netty using scala (DEPRECATED)
Scala
74
star
47

cdk

CDK is a tool to quickly generate single-file html slide presentations from AsciiDoc
CSS
73
star
48

twitter-kit-unity

Twitter Kit for Unity
C#
71
star
49

plumage.js

Batteries Included App Framework for Data Intensive UIs
JavaScript
66
star
50

gozer

Prototype mesos framework using new low-level API built in Go
Go
61
star
51

bookkeeper

Twitter's fork of Apache BookKeeper (will push changes upstream eventually)
Java
60
star
52

grabby-hands

A JVM Kestrel client that aggregates queues from multiple servers. Implemented in Scala with Java bindings. In use at Twitter for all JVM Search and Streaming Kestrel interactions.
Scala
56
star
53

gizzmo

A command-line client for Gizzard
Ruby
54
star
54

thrift

Twitter's out-of-date, forked thrift
C++
52
star
55

libkestrel

libkestrel
Scala
47
star
56

time_constants

Time constants, in seconds, so you don't have to use slow ActiveSupport helpers
Ruby
46
star
57

sbt-scrooge

An SBT plugin that adds a mixin for doing Thrift code auto-generation during your compile phase
Scala
44
star
58

cli-guide.js

CLI Guide JQuery Plugin
JavaScript
41
star
59

sbt-thrift

sbt rules for generating source stubs out of thrift IDLs, for java & scala
Ruby
37
star
60

jaqen

A type-safe heterogenous Map or a Named field Tuple
Scala
35
star
61

spitball

A very simple gem package generation tool built on bundler
Ruby
33
star
62

torch-thrift

A Thrift codec for Torch
C
30
star
63

jsr166e

JSR166e for Twitter
Java
27
star
64

unishark

Unishark: Another unittest extension for Python
Python
26
star
65

raggiana

A simple standalone Finagle stats viewer
JavaScript
21
star
66

sekhmet

foundational tools and building blocks for gaining insights and diagnosing system health in real-time
20
star
67

periscope-live-engagement-unity-sdk

Periscope Live Engagement Unity SDK
C#
20
star
68

twitterActors

Improved Scala actors library; used internally at Twitter
Scala
18
star
69

finatra-activator-http-seed

Typesafe activator template for constructing a Finatra HTTP server application:
Scala
18
star
70

killdeer

Killdeer is a simple server for replaying a sample of responses to sythentically recreate production response characteristics.
Scala
15
star
71

bittern

Bittern Cache uses nvdimm to speed up block io operations
C
14
star
72

elephant-twin-lzo

Elephant Twin LZO uses Elephant Twin to create LZO block indexes
Java
14
star
73

finatra-activator-thrift-seed

Typesafe activator template for constructing a Finatra Thrift server application: https://twitter.github.io/finatra/user-guide/ โ€”
Scala
11
star
74

chainsaw

A thin Scala wrapper for SLF4J
Scala
9
star
75

PerfTracepoint

Perf tracepoint support for the JVM
Java
7
star
76

oscon-puzzles

OSCON 2014 Puzzle
JavaScript
7
star
77

scala-json

JSON in Scala (deprecated)
Scala
5
star
78

scala-csp-config

A Scala library for configuring Content Security Policy headers for HTTP responses.
Scala
4
star
79

finatra-misc

Miscellaneous libraries and utils used by Finatra
Scala
3
star
80

.github

2
star
81

autolog-clustering

USF Capstone Project for Auto-log Clustering
Python
1
star