centos7源码安装memaslap(libmemcached)——memcached benchmark testing tool

memaslap is a load generation and benchmark tool for memcached servers. It generates configurable workload such as threads, concurrencies,connections, run time, overwrite, miss rate, key size, value size, get/setproportion, expected throughput, and so on. Furthermore, it also tests dataverification, expire-time verification, UDP, binary protocol, facebook test,replication test, multi-get and reconnection, etc.

可以认为memaslap是emslap的升级版,提供更多features。


前提:已安装memcached,确保已安装libevent库

yum install libevent.x86_64  libevent-devel.x86_64    memcached.x86_64

memaslap是 libmemcached的一个组件,因此需要编译安装。(libmemcached 是一个 memcached 的库,客户端库,C 和 C++ 语言实现的客户端库,具有低内存占用率、线程安全、并提供对memcached功能的全面支持。)

  wget  https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz  
  tar zxvf libmemcached-1.0.18.tar.gz -C /data/  
  cd /data/libmemcached-1.0.18/  
  ./configure -prefix=/usr/local/libmemcached --with-memcached --enable-memaslap
  make  
  make install
如果在/usr/local/libmemcached/bin下有memaslap这个文件,则表示安装成功


可能遇到的问题

1.

扫描二维码关注公众号,回复: 3146559 查看本文章

/bin/ld: clients/ms_thread.o: undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
/bin/ld: note: 'pthread_key_delete@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [clients/memaslap] Error 1

解决办法

Try going into the Makefile and adding '-L/lib64 -lpthread' to the variable LDFLAGS.

LDFLAGS变量位于Makefile文件2937行

然后make & make install即可

参考链接  这哥们说的语法有问题


2. c++编译器未安装

# centos7
yum group install "Development Tools" 

# 如果报错
./libtool: line 990: g++: command not found报错信息
yum -y install gcc* 
# 然后继续make

# centos6
 https://www.vultr.com/docs/how-to-install-gcc-on-centos-6

最后展示一下

$ /usr/local/libmemcached/bin/memaslap -h
memslap v1.0
    Generates workload against memcached servers.

Usage:
    memslap -hV | -s servers [-F config_file] [-t time | -x exe_num] [...]

Options:
    -s, --servers=
        List one or more servers to connect. Servers count must be less than
        threads count. e.g.: --servers=localhost:1234,localhost:11211
    -T, --threads=
        Number of threads to startup, better equal to CPU numbers. Default 8.
    -c, --concurrency=
        Number of concurrency to simulate with load. Default 128.
    -n, --conn_sock=
        Number of TCP socks per concurrency. Default 1.
    -x, --execute_number=
        Number of operations(get and set) to execute for the
        given test. Default 1000000.
    -t, --time=
        How long the test to run, suffix: s-seconds, m-minutes, h-hours,
        d-days e.g.: --time=2h.
    -F, --cfg_cmd=

▽
        Load the configure file to get command,key and value distribution list.
    -w, --win_size=
        Task window size of each concurrency, suffix: K, M e.g.: --win_size=10k.
        Default 10k.
    -X, --fixed_size=
        Fixed length of value.
    -v, --verify=
        The proportion of date verification, e.g.: --verify=0.01
    -d, --division=
        Number of keys to multi-get once. Default 1, means single get.
    -S, --stat_freq=
        Frequency of dumping statistic information. suffix: s-seconds,
        m-minutes, e.g.: --resp_freq=10s.
    -e, --exp_verify=
        The proportion of objects with expire time, e.g.: --exp_verify=0.01.
        Default no object with expire time
    -o, --overwrite=
        The proportion of objects need overwrite, e.g.: --overwrite=0.01.
        Default never overwrite object.
    -R, --reconnect
        Reconnect support, when connection is closed it will be reconnected.
    -U, --udp
        UDP support, default memslap uses TCP, TCP port and UDP port of
        server must be same.
    -a, --facebook
        Whether it enables facebook test feature, set with TCP and multi-get with UDP.
    -B, --binary
        Whether it enables binary protocol. Default with ASCII protocol.
    -P, --tps=
        Expected throughput, suffix: K, e.g.: --tps=10k.
    -p, --rep_write=
        The first nth servers can write data, e.g.: --rep_write=2.
    -b, --verbose
        Whether it outputs detailed information when verification fails.
    -h, --help
        Display this message and then exit.
    -V, --version
        Display the version of the application and then exit.

Examples:
    memslap -s 127.0.0.1:11211 -S 5s
    memslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b
    memslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2
    memslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k
    memslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40
    memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m
    memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2

参考

memaslap官网文档 

http://blog.csdn.net/wangsg2014/article/details/17451273

http://blog.csdn.net/jzmzy/article/details/47806371


猜你喜欢

转载自blog.csdn.net/yangcs2009/article/details/51692579