使用sysbench测试lightdb性能

技术杂谈113

1、sysbench可用于测试mysql和lightdb性能。首先安装lightdb,可参考https://www.cnblogs.com/zhjh256/p/15170255.html或https://www.hs.net/lightdb/docs/LightDB_Install_Manual.pdf

2、其次,安装sysbench,从https://github.com/akopytov/sysbench下载最新版。master也可以。然后解压:

``
[zjh@hs-10-20-30-193 sysbench-master]$ ./autogen.sh
autoreconf: Entering directory
.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy
libtoolize: config/ltmain.sh' is newer: use--force' to overwrite
libtoolize: m4/libtool.m4' is newer: use--force' to overwrite
libtoolize: m4/ltoptions.m4' is newer: use--force' to overwrite
libtoolize: m4/ltversion.m4' is newer: use--force' to overwrite
autoreconf: running: /usr/bin/autoconf
autoreconf: running: /usr/bin/autoheader
autoreconf: running: automake --add-missing --copy --no-force
autoreconf: Leaving directory `.'

[zjh@hs-10-20-30-193 sysbench-master]$ ./configure --prefix=/home/zjh/sysbench --without-mysql --with-pgsql --with-pgsql-includes=/home/zjh/lightdb-x-dev-server/include --with-pgsql-libs=/home/zjh/lightdb-x-dev-server/lib
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...

checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define EXTENSIONS... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for gcc option to accept ISO C99... -std=gnu99
checking how to run the C preprocessor... gcc -E
checking whether gcc -std=gnu99 and cc understand -c and -o together... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for C compiler vendor... gnu
checking for gcc architecture flag...

checking for x86 cpuid 0 output... 16:756e6547:6c65746e:49656e69
checking for x86 cpuid 1 output... 50657:4d400800:7ffefbff:bfebfbff
checking whether C compiler accepts -march=core2... yes
checking for gcc architecture flag... -march=core2
checking for ar... ar
checking the archiver (ar) interface... ar
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc -std=gnu99... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc -std=gnu99 object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no
checking for gcc -std=gnu99 option to produce PIC... -fPIC -DPIC
checking if gcc -std=gnu99 PIC flag -fPIC -DPIC works... yes
checking if gcc -std=gnu99 static flag -static works... yes
checking if gcc -std=gnu99 supports -c -o file.o... yes
checking if gcc -std=gnu99 supports -c -o file.o... (cached) yes
checking whether the gcc -std=gnu99 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for pkg-config... yes
checking for C compiler vendor... (cached) gnu
checking whether to compile with MySQL support... no
checking whether to compile with PostgreSQL support... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether to build with system or bundled LuaJIT... bundled
checking whether to build with system or bundled Concurrency Kit... bundled
checking whether SHM_HUGETLB is declared... yes
checking whether O_SYNC is declared... yes
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for sqrt in -lm... yes
checking PostgreSQL includes... (cached) /home/zjh/lightdb-x-dev-server/include
checking PostgreSQL libraries... (cached) /home/zjh/lightdb-x-dev-server/lib
checking libaio.h usability... yes
checking libaio.h presence... yes
checking for libaio.h... yes
checking for io_queue_init in -laio... yes
checking if io_getevents() has an old interface... no
checking for ANSI C header files... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/aio.h usability... no
checking sys/aio.h presence... no
checking for sys/aio.h... no
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking thread.h usability... no
checking thread.h presence... no
checking for thread.h... no
checking for unistd.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking for off_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for thread local storage (TLS) class... thread
checking for __attribute
((format))... yes
checking for attribute((unused))... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of size_t... 8
checking size of bool... 1
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking for library containing clock_gettime... none required
checking for alarm... yes
checking for clock_gettime... yes
checking for directio... no
checking for fdatasync... yes
checking for gettimeofday... yes
checking for isatty... yes
checking for memalign... yes
checking for memset... yes
checking for posix_memalign... yes
checking for pthread_cancel... yes
checking for pthread_yield... yes
checking for setvbuf... yes
checking for sqrt... yes
checking for strdup... yes
checking for thr_setconcurrency... no
checking for valloc... yes
checking for pthread_once... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating third_party/luajit/Makefile
config.status: creating third_party/concurrency_kit/Makefile
config.status: creating src/Makefile
config.status: creating src/drivers/Makefile
config.status: creating src/drivers/mysql/Makefile
config.status: creating src/drivers/pgsql/Makefile
config.status: creating src/tests/Makefile
config.status: creating src/tests/cpu/Makefile
config.status: creating src/tests/fileio/Makefile
config.status: creating src/tests/memory/Makefile
config.status: creating src/tests/threads/Makefile
config.status: creating src/tests/mutex/Makefile
config.status: creating src/lua/Makefile
config.status: creating src/lua/internal/Makefile
config.status: creating tests/Makefile
config.status: creating tests/include/config.sh
config.status: creating snap/snapcraft.yaml
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
===============================================================================
sysbench version : 1.1.0
CC : gcc -std=gnu99
CFLAGS : -O3 -funroll-loops -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla -pthread
CPPFLAGS : -D_GNU_SOURCE -I$(top_srcdir)/src -I$(abs_top_builddir)/third_party/luajit/inc -I$(abs_top_builddir)/third_party/concurrency_kit/include
LDFLAGS :
LIBS : -laio -lm

prefix : /home/zjh/sysbench
bindir : ${prefix}/bin
libexecdir : ${prefix}/libexec
mandir : ${prefix}/share/man
datadir : ${prefix}/share

MySQL support : no
PostgreSQL support : yes

LuaJIT : bundled
LUAJIT_CFLAGS : -I$(abs_top_builddir)/third_party/luajit/inc
LUAJIT_LIBS : $(abs_top_builddir)/third_party/luajit/lib/libluajit-5.1.a -ldl
LUAJIT_LDFLAGS : -rdynamic

Concurrency Kit : bundled
CK_CFLAGS : -I$(abs_top_builddir)/third_party/concurrency_kit/include
CK_LIBS : $(abs_top_builddir)/third_party/concurrency_kit/lib/libck.a
configure flags :
===============================================================================
[zjh@hs-10-20-30-193 sysbench-master]$ make
Making all in third_party/luajit
make[1]: Entering directory /home/zjh/sysbench-master/third_party/luajit'
make -C ./luajit clean
make[2]: Entering directory
/home/zjh/sysbench-master/third_party/luajit/luajit'
make -C src clean
make[3]: Entering directory /home/zjh/sysbench-master/third_party/luajit/luajit/src'
rm -f luajit libluajit.a libluajit.so host/minilua host/buildvm lj_vm.S lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h host/buildvm_arch.h jit/vmdef.lua *.o host/*.o *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
make[3]: Leaving directory
/home/zjh/sysbench-master/third_party/luajit/luajit/src'
make[2]: Leaving directory /home/zjh/sysbench-master/third_party/luajit/luajit'
rm -rf tmp
mkdir tmp
tar -C . -cf - luajit | tar -xf - -C tmp/
chmod -R u+w tmp
make -C tmp/luajit \
PREFIX=/home/zjh/sysbench-master/third_party/luajit \
INSTALL_INC=/home/zjh/sysbench-master/third_party/luajit/inc \
install
make[2]: Entering directory
/home/zjh/sysbench-master/third_party/luajit/tmp/luajit'
==== Building LuaJIT 2.1.0-beta3 ====
make -C src
make[3]: Entering directory /home/zjh/sysbench-master/third_party/luajit/tmp/luajit/src'
HOSTCC host/minilua.o
HOSTLINK host/minilua
DYNASM host/buildvm_arch.h
HOSTCC host/buildvm.o
HOSTCC host/buildvm_asm.o
HOSTCC host/buildvm_peobj.o
HOSTCC host/buildvm_lib.o
HOSTCC host/buildvm_fold.o
HOSTLINK host/buildvm
BUILDVM lj_vm.S
ASM lj_vm.o
CC lj_gc.o
BUILDVM lj_ffdef.h
CC lj_err.o
CC lj_char.o
BUILDVM lj_bcdef.h
CC lj_bc.o
CC lj_obj.o
CC lj_buf.o
CC lj_str.o
CC lj_tab.o
CC lj_func.o
CC lj_udata.o
CC lj_meta.o
CC lj_debug.o
CC lj_state.o
CC lj_dispatch.o
CC lj_vmevent.o
CC lj_vmmath.o
CC lj_strscan.o
CC lj_strfmt.o
CC lj_strfmt_num.o
CC lj_api.o
CC lj_profile.o
CC lj_lex.o
CC lj_parse.o
CC lj_bcread.o
CC lj_bcwrite.o
CC lj_load.o
CC lj_ir.o
CC lj_opt_mem.o
BUILDVM lj_folddef.h
CC lj_opt_fold.o
CC lj_opt_narrow.o
CC lj_opt_dce.o
CC lj_opt_loop.o
CC lj_opt_split.o
CC lj_opt_sink.o
CC lj_mcode.o
CC lj_snap.o
CC lj_record.o
CC lj_crecord.o
BUILDVM lj_recdef.h
CC lj_ffrecord.o
CC lj_asm.o
CC lj_trace.o
CC lj_gdbjit.o
CC lj_ctype.o
CC lj_cdata.o
CC lj_cconv.o
CC lj_ccall.o
CC lj_ccallback.o
CC lj_carith.o
CC lj_clib.o
CC lj_cparse.o
CC lj_lib.o
CC lj_alloc.o
CC lib_aux.o
BUILDVM lj_libdef.h
CC lib_base.o
CC lib_math.o
CC lib_bit.o
CC lib_string.o
CC lib_table.o
CC lib_io.o
CC lib_os.o
CC lib_package.o
CC lib_debug.o
CC lib_jit.o
CC lib_ffi.o
CC lib_init.o
AR libluajit.a
CC luajit.o
BUILDVM jit/vmdef.lua
DYNLINK libluajit.so
LINK luajit
OK Successfully built LuaJIT
make[3]: Leaving directory
/home/zjh/sysbench-master/third_party/luajit/tmp/luajit/src'
==== Successfully built LuaJIT 2.1.0-beta3 ====
==== Installing LuaJIT 2.1.0-beta3 to /home/zjh/sysbench-master/third_party/luajit ====
mkdir -p /home/zjh/sysbench-master/third_party/luajit/bin /home/zjh/sysbench-master/third_party/luajit/lib /home/zjh/sysbench-master/third_party/luajit/inc /home/zjh/sysbench-master/third_party/luajit/share/man/man1 /home/zjh/sysbench-master/third_party/luajit/lib/pkgconfig /home/zjh/sysbench-master/third_party/luajit/share/luajit-2.1.0-beta3/jit /home/zjh/sysbench-master/third_party/luajit/share/lua/5.1 /home/zjh/sysbench-master/third_party/luajit/lib/lua/5.1
cd src && install -m 0755 luajit /home/zjh/sysbench-master/third_party/luajit/bin/luajit-2.1.0-beta3
cd src && test -f libluajit.a && install -m 0644 libluajit.a /home/zjh/sysbench-master/third_party/luajit/lib/libluajit-5.1.a || :
rm -f /home/zjh/sysbench-master/third_party/luajit/lib/libluajit-5.1.so.2.1.0 /home/zjh/sysbench-master/third_party/luajit/lib/libluajit-5.1.so /home/zjh/sysbench-master/third_party/luajit/lib/libluajit-5.1.so.2
cd src && test -f libluajit.so && \
install -m 0755 libluajit.so /home/zjh/sysbench-master/third_party/luajit/lib/libluajit-5.1.so.2.1.0 && \
( ldconfig -n 2>/dev/null /home/zjh/sysbench-master/third_party/luajit/lib || : ) && \
ln -sf libluajit-5.1.so.2.1.0 /home/zjh/sysbench-master/third_party/luajit/lib/libluajit-5.1.so && \
ln -sf libluajit-5.1.so.2.1.0 /home/zjh/sysbench-master/third_party/luajit/lib/libluajit-5.1.so.2 || :
cd etc && install -m 0644 luajit.1 /home/zjh/sysbench-master/third_party/luajit/share/man/man1
cd etc && sed -e "s|^prefix=.|prefix=/home/zjh/sysbench-master/third_party/luajit|" -e "s|^multilib=.|multilib=lib|" luajit.pc > luajit.pc.tmp && \
install -m 0644 luajit.pc.tmp /home/zjh/sysbench-master/third_party/luajit/lib/pkgconfig/luajit.pc && \
rm -f luajit.pc.tmp
cd src && install -m 0644 lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h /home/zjh/sysbench-master/third_party/luajit/inc
cd src/jit && install -m 0644 bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua dis_mips64.lua dis_mips64el.lua vmdef.lua /home/zjh/sysbench-master/third_party/luajit/share/luajit-2.1.0-beta3/jit
==== Successfully installed LuaJIT 2.1.0-beta3 to /home/zjh/sysbench-master/third_party/luajit ====

Note: the development releases deliberately do NOT install a symlink for luajit
You can do this now by running this command (with sudo):

ln -sf luajit-2.1.0-beta3 /home/zjh/sysbench-master/third_party/luajit/bin/luajit

make[2]: Leaving directory /home/zjh/sysbench-master/third_party/luajit/tmp/luajit'
make[1]: Leaving directory
/home/zjh/sysbench-master/third_party/luajit'
Making all in third_party/concurrency_kit
make[1]: Entering directory `/home/zjh/sysbench-master/third_party/concurrency_kit'
rm -rf tmp
mkdir tmp
tar -C . -cf - ck | tar -xf - -C tmp/
chmod -R u+w tmp
cd tmp/ck && \
CC="gcc -std=gnu99" \
CFLAGS="-O3 -funroll-loops -D_GNU_SOURCE " \
LDFLAGS="" \
./configure \
--prefix=/home/zjh/sysbench-master/third_party/concurrency_kit && \
make && \
make install
Detecting operating system.......success [linux]
Detecting machine architecture...success [x86_64]
Finding dirname command..........success [/usr/bin/dirname]
Determining build directory......success [/home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck]
Finding gzip tool................success [/usr/bin/gzip]
Finding suitable compiler........success [/usr/bin/gcc]
Detecting VMA bits...............success [48]
Checking header file usability...success [stdbool.h]
Checking header file usability...success [stddef.h]
Checking header file usability...success [stdint.h]
Checking header file usability...success [string.h]
Detecting git SHA................not within a git repo []
Generating header files..........success
Generating build files...........success

       VERSION = 1.0.0
       GIT_SHA =
     BUILD_DIR = /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck
       SRC_DIR = /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck
        SYSTEM = linux
       PROFILE = x86_64
            CC = /usr/bin/gcc
      COMPILER = gcc
        CFLAGS = -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses -O3 -funroll-loops  -D_GNU_SOURCE  -fPIC
PTHREAD_CFLAGS = -pthread
            LD = /usr/bin/gcc
        LDNAME = libck.so
LDNAME_VERSION = libck.so.1.0.0
  LDNAME_MAJOR = libck.so.0
       LDFLAGS = -Wl,-soname,libck.so.0 -m64  -shared -fPIC
          GZIP = /usr/bin/gzip -c
         CORES = 32
  POINTER_PACK = CK_MD_POINTER_PACK_DISABLE
      VMA_BITS = 48
  MEMORY_MODEL = CK_MD_TSO
           RTM = CK_MD_RTM_DISABLE
           LSE = CK_MD_LSE_DISABLE

Headers will be installed in /home/zjh/sysbench-master/third_party/concurrency_kit/include
Libraries will be installed in /home/zjh/sysbench-master/third_party/concurrency_kit/lib
Documentation will be installed in /home/zjh/sysbench-master/third_party/concurrency_kit/share/man
make[2]: Entering directory /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck'
make -C doc all || exit
make[3]: Entering directory
/home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc'
for target in CK_ARRAY_FOREACH ck_array_buffer ck_array_commit ck_array_deinit ck_array_init ck_array_initialized ck_array_length ck_array_put ck_array_put_unique ck_array_remove ck_array_deinit ck_brlock ck_ht_count ck_ht_destroy ck_ht_gc ck_ht_get_spmc ck_ht_grow_spmc ck_ht_hash ck_ht_hash_direct ck_ht_init ck_ht_put_spmc ck_ht_remove_spmc ck_ht_reset_spmc ck_ht_reset_size_spmc ck_ht_set_spmc ck_ht_entry_empty ck_ht_entry_key ck_ht_entry_key_direct ck_ht_entry_key_length ck_ht_entry_key_set ck_ht_entry_key_set_direct ck_ht_entry_set ck_ht_entry_set_direct ck_ht_entry_value_direct ck_ht_entry_value ck_ht_iterator_init ck_ht_next ck_ht_stat ck_bitmap_init ck_bitmap_reset ck_bitmap_set ck_bitmap_bts ck_bitmap_test ck_bitmap_base ck_bitmap_union ck_bitmap_size ck_bitmap_clear ck_bitmap_bits ck_bitmap_buffer ck_bitmap_next ck_bitmap_iterator_init ck_elide ck_epoch_barrier ck_epoch_begin ck_epoch_call ck_epoch_end ck_epoch_init ck_epoch_poll ck_epoch_recycle ck_epoch_register ck_epoch_reclaim ck_epoch_synchronize ck_epoch_unregister ck_hs_gc ck_hs_init ck_hs_destroy CK_HS_HASH ck_hs_apply ck_hs_iterator_init ck_hs_next ck_hs_get ck_hs_put ck_hs_put_unique ck_hs_set ck_hs_fas ck_hs_remove ck_hs_move ck_hs_grow ck_hs_rebuild ck_hs_count ck_hs_reset ck_hs_reset_size ck_hs_stat ck_rhs_gc ck_rhs_init ck_rhs_destroy CK_RHS_HASH ck_rhs_apply ck_rhs_iterator_init ck_rhs_next ck_rhs_get ck_rhs_put ck_rhs_put_unique ck_rhs_set ck_rhs_fas ck_rhs_remove ck_rhs_move ck_rhs_grow ck_rhs_rebuild ck_rhs_count ck_rhs_reset ck_rhs_reset_size ck_rhs_stat ck_rwcohort CK_RWCOHORT_INIT CK_RWCOHORT_INSTANCE CK_RWCOHORT_PROTOTYPE CK_RWCOHORT_READ_LOCK CK_RWCOHORT_READ_UNLOCK CK_RWCOHORT_WRITE_LOCK CK_RWCOHORT_WRITE_UNLOCK ck_cohort CK_COHORT_PROTOTYPE CK_COHORT_TRYLOCK_PROTOTYPE CK_COHORT_INSTANCE CK_COHORT_INIT CK_COHORT_LOCK CK_COHORT_UNLOCK CK_COHORT_TRYLOCK ck_pr ck_pr_fence_acquire ck_pr_fence_release ck_pr_barrier ck_pr_fas ck_pr_fence_atomic ck_pr_fence_atomic_load ck_pr_fence_atomic_store ck_pr_fence_load ck_pr_fence_load_atomic ck_pr_fence_load_store ck_pr_fence_load_depends ck_pr_fence_memory ck_pr_fence_store ck_pr_fence_store_atomic ck_pr_fence_store_load ck_pr_stall ck_pr_faa ck_pr_inc ck_pr_dec ck_pr_not ck_pr_neg ck_pr_add ck_pr_sub ck_pr_and ck_pr_xor ck_pr_or ck_pr_cas ck_pr_bts ck_pr_btc ck_pr_btr ck_pr_store ck_pr_load ck_pr_rtm ck_queue ck_ring_init ck_ring_dequeue_spmc ck_ring_enqueue_spmc ck_ring_enqueue_spmc_size ck_ring_trydequeue_spmc ck_ring_dequeue_spsc ck_ring_enqueue_spsc ck_ring_enqueue_spsc_size ck_ring_size ck_ring_capacity ck_tflock ck_rwlock ck_pflock ck_swlock ck_sequence ck_spinlock; do \
/usr/bin/gzip -c /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc/$target > /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc/$target.3.gz; \
done
make[3]: Leaving directory `/home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc'

make[2]: Leaving directory /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck'
make[2]: Entering directory
/home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck'
make -C doc all || exit
make[3]: Entering directory /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc'
for target in CK_ARRAY_FOREACH ck_array_buffer ck_array_commit ck_array_deinit ck_array_init ck_array_initialized ck_array_length ck_array_put ck_array_put_unique ck_array_remove ck_array_deinit ck_brlock ck_ht_count ck_ht_destroy ck_ht_gc ck_ht_get_spmc ck_ht_grow_spmc ck_ht_hash ck_ht_hash_direct ck_ht_init ck_ht_put_spmc ck_ht_remove_spmc ck_ht_reset_spmc ck_ht_reset_size_spmc ck_ht_set_spmc ck_ht_entry_empty ck_ht_entry_key ck_ht_entry_key_direct ck_ht_entry_key_length ck_ht_entry_key_set ck_ht_entry_key_set_direct ck_ht_entry_set ck_ht_entry_set_direct ck_ht_entry_value_direct ck_ht_entry_value ck_ht_iterator_init ck_ht_next ck_ht_stat ck_bitmap_init ck_bitmap_reset ck_bitmap_set ck_bitmap_bts ck_bitmap_test ck_bitmap_base ck_bitmap_union ck_bitmap_size ck_bitmap_clear ck_bitmap_bits ck_bitmap_buffer ck_bitmap_next ck_bitmap_iterator_init ck_elide ck_epoch_barrier ck_epoch_begin ck_epoch_call ck_epoch_end ck_epoch_init ck_epoch_poll ck_epoch_recycle ck_epoch_register ck_epoch_reclaim ck_epoch_synchronize ck_epoch_unregister ck_hs_gc ck_hs_init ck_hs_destroy CK_HS_HASH ck_hs_apply ck_hs_iterator_init ck_hs_next ck_hs_get ck_hs_put ck_hs_put_unique ck_hs_set ck_hs_fas ck_hs_remove ck_hs_move ck_hs_grow ck_hs_rebuild ck_hs_count ck_hs_reset ck_hs_reset_size ck_hs_stat ck_rhs_gc ck_rhs_init ck_rhs_destroy CK_RHS_HASH ck_rhs_apply ck_rhs_iterator_init ck_rhs_next ck_rhs_get ck_rhs_put ck_rhs_put_unique ck_rhs_set ck_rhs_fas ck_rhs_remove ck_rhs_move ck_rhs_grow ck_rhs_rebuild ck_rhs_count ck_rhs_reset ck_rhs_reset_size ck_rhs_stat ck_rwcohort CK_RWCOHORT_INIT CK_RWCOHORT_INSTANCE CK_RWCOHORT_PROTOTYPE CK_RWCOHORT_READ_LOCK CK_RWCOHORT_READ_UNLOCK CK_RWCOHORT_WRITE_LOCK CK_RWCOHORT_WRITE_UNLOCK ck_cohort CK_COHORT_PROTOTYPE CK_COHORT_TRYLOCK_PROTOTYPE CK_COHORT_INSTANCE CK_COHORT_INIT CK_COHORT_LOCK CK_COHORT_UNLOCK CK_COHORT_TRYLOCK ck_pr ck_pr_fence_acquire ck_pr_fence_release ck_pr_barrier ck_pr_fas ck_pr_fence_atomic ck_pr_fence_atomic_load ck_pr_fence_atomic_store ck_pr_fence_load ck_pr_fence_load_atomic ck_pr_fence_load_store ck_pr_fence_load_depends ck_pr_fence_memory ck_pr_fence_store ck_pr_fence_store_atomic ck_pr_fence_store_load ck_pr_stall ck_pr_faa ck_pr_inc ck_pr_dec ck_pr_not ck_pr_neg ck_pr_add ck_pr_sub ck_pr_and ck_pr_xor ck_pr_or ck_pr_cas ck_pr_bts ck_pr_btc ck_pr_btr ck_pr_store ck_pr_load ck_pr_rtm ck_queue ck_ring_init ck_ring_dequeue_spmc ck_ring_enqueue_spmc ck_ring_enqueue_spmc_size ck_ring_trydequeue_spmc ck_ring_dequeue_spsc ck_ring_enqueue_spsc ck_ring_enqueue_spsc_size ck_ring_size ck_ring_capacity ck_tflock ck_rwlock ck_pflock ck_swlock ck_sequence ck_spinlock; do \
/usr/bin/gzip -c /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc/$target > /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc/$target.3.gz; \
done
make[3]: Leaving directory
/home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc'

mkdir -p //home/zjh/sysbench-master/third_party/concurrency_kit/include || exit
cp /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/include/.h //home/zjh/sysbench-master/third_party/concurrency_kit/include || exit
chmod 644 //home/zjh/sysbench-master/third_party/concurrency_kit/include/ck_
.h || exit
mkdir -p /home/zjh/sysbench-master/third_party/concurrency_kit/include/gcc || exit
cp -r /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/include/gcc/ //home/zjh/sysbench-master/third_party/concurrency_kit/include/gcc || exit
cp include/ck_md.h //home/zjh/sysbench-master/third_party/concurrency_kit/include/ck_md.h || exit
chmod 755 //home/zjh/sysbench-master/third_party/concurrency_kit/include/gcc
chmod 644 //home/zjh/sysbench-master/third_party/concurrency_kit/include/gcc/ck_
.h //home/zjh/sysbench-master/third_party/concurrency_kit/include/gcc//ck_.h || exit
mkdir -p /home/zjh/sysbench-master/third_party/concurrency_kit/include/spinlock || exit
cp -r /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/include/spinlock/ //home/zjh/sysbench-master/third_party/concurrency_kit/include/spinlock || exit
chmod 755 //home/zjh/sysbench-master/third_party/concurrency_kit/include/spinlock
chmod 644 //home/zjh/sysbench-master/third_party/concurrency_kit/include/spinlock/
.h || exit
mkdir -p //home/zjh/sysbench-master/third_party/concurrency_kit/lib
cp src/libck.so //home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.so.1.0.0
ln -sf libck.so.1.0.0 //home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.so
ln -sf libck.so.1.0.0 //home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.so.0
chmod 744 //home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.so.1.0.0 \
//home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.so \
//home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.so.0
mkdir -p //home/zjh/sysbench-master/third_party/concurrency_kit/lib
cp src/libck.a //home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.a
chmod 644 //home/zjh/sysbench-master/third_party/concurrency_kit/lib/libck.a
make -C doc install
make[3]: Entering directory /home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc'
mkdir -p //home/zjh/sysbench-master/third_party/concurrency_kit/share/man/man3 || exit
cp *.3.gz //home/zjh/sysbench-master/third_party/concurrency_kit/share/man/man3 || exit
make[3]: Leaving directory
/home/zjh/sysbench-master/third_party/concurrency_kit/tmp/ck/doc'
mkdir -p //home/zjh/sysbench-master/third_party/concurrency_kit/lib || exit
mkdir -p //home/zjh/sysbench-master/third_party/concurrency_kit/lib/pkgconfig || exit
chmod 755 //home/zjh/sysbench-master/third_party/concurrency_kit/lib/pkgconfig
cp build/ck.pc //home/zjh/sysbench-master/third_party/concurrency_kit/lib/pkgconfig/ck.pc || exit

Original: https://www.cnblogs.com/zhjh256/p/16306206.html
Author: zhjh256
Title: 使用sysbench测试lightdb性能



相关阅读

Title: RESTful API设计规范

RESTful 是目前最流行的 API 设计规范,用于 Web 数据接口的设计。

它的大原则容易把握,但是细节不容易做对。本文总结 RESTful 的设计细节,介绍如何设计出易于理解和使用的 API。

一 URL设计

RESTful的核心思想就是,客户端发出的数据+操作指令都是"动词+宾语"的结构,比如GET /articles这个命令,GET是动词,/articles是宾语,动词通常就有5种HTTP请求方法,对应CRUD操作,根据 HTTP 规范,动词一律大写。

有些客户端只能使用 GETPOST这两种方法。服务器必须接受 POST模拟其他三个方法( PUTPATCHDELETE)。这时,客户端发出的 HTTP 请求,要加上 X-HTTP-Method-Override属性,告诉服务器应该使用哪一个动词,覆盖 POST方法。

上面代码中, X-HTTP-Method-Override指定本次请求的方法是 PUT,而不是 POST

宾语就是 API 的 URL,是 HTTP 动词作用的对象。它应该是名词,不能是动词。比如, /articles这个 URL 就是正确的,而下面的 URL 不是名词,所以都是错误的。

既然 URL 是名词,那么应该使用复数,还是单数?这没有统一的规定,但是常见的操作是读取一个集合,比如 GET /articles(读取所有文章),这里明显应该是复数。

为了统一起见,建议都使用复数 URL,比如 GET /articles/2要好于 GET /article/2

常见的情况是,资源需要多级分类,因此很容易写出多级的 URL,比如获取某个作者的某一类文章。

这种 URL 不利于扩展,语义也不明确,往往要想一会,才能明白含义。

更好的做法是,除了第一级,其他级别都用查询字符串表达。

下面是另一个例子,查询已发布的文章。你可能会设计成下面的 URL。

查询字符串的写法明显更好

二、状态码

客户端的每一次请求,服务器都必须给出回应。回应包括 HTTP 状态码和数据两部分。

HTTP 状态码就是一个三位数,分成五个类别。

这五大类总共包含100多种状态码,覆盖了绝大部分可能遇到的情况。每一种状态码都有标准的(或者约定的)解释,客户端只需查看状态码,就可以判断出发生了什么情况,所以服务器应该返回尽可能精确的状态码。

API 不需要 1xx状态码,下面介绍其他四类状态码的精确含义。

200状态码表示操作成功,但是不同的方法可以返回更精确的状态码。

上面代码中, POST返回 201状态码,表示生成了新的资源; DELETE返回 204状态码,表示资源已经不存在。

此外, 202 Accepted状态码表示服务器已经收到请求,但还未进行处理,会在未来再处理,通常用于异步操作。下面是一个例子。

API 用不到 301状态码(永久重定向)和 302状态码(暂时重定向, 307也是这个含义),因为它们可以由应用级别返回,浏览器会直接跳转,API 级别可以不考虑这两种情况。

API 用到的 3xx状态码,主要是 303 See Other,表示参考另一个 URL。它与 302307的含义一样,也是"暂时重定向",区别在于 302307用于 GET请求,而 303用于 POSTPUTDELETE请求。收到 303以后,浏览器不会自动跳转,而会让用户自己决定下一步怎么办。下面是一个例子。

4xx状态码表示客户端错误,主要有下面几种。

400 Bad Request:服务器不理解客户端的请求,未做任何处理。

401 Unauthorized:用户未提供身份验证凭据,或者没有通过身份验证。

403 Forbidden:用户通过了身份验证,但是不具有访问资源所需的权限。

404 Not Found:所请求的资源不存在,或不可用。

405 Method Not Allowed:用户已经通过身份验证,但是所用的 HTTP 方法不在他的权限之内。

410 Gone:所请求的资源已从这个地址转移,不再可用。

415 Unsupported Media Type:客户端要求的返回格式不支持。比如,API 只能返回 JSON 格式,但是客户端要求返回 XML 格式。

422 Unprocessable Entity :客户端上传的附件无法处理,导致请求失败。

429 Too Many Requests:客户端的请求次数超过限额。

5xx状态码表示服务端错误。一般来说,API 不会向用户透露服务器的详细信息,所以只要两个状态码就够了。

500 Internal Server Error:客户端请求有效,服务器处理时发生了意外。

503 Service Unavailable:服务器无法处理请求,一般用于网站维护状态。

三、服务器回应

API 返回的数据格式,不应该是纯文本,而应该是一个 JSON 对象,因为这样才能返回标准的结构化数据。所以,服务器回应的 HTTP 头的 Content-Type属性要设为 application/json

客户端请求时,也要明确告诉服务器,可以接受 JSON 格式,即请求的 HTTP 头的 ACCEPT属性也要设成 application/json。下面是一个例子。

有一种不恰当的做法是,即使发生错误,也返回 200状态码,把错误信息放在数据体里面,就像下面这样。

上面代码中,解析数据体以后,才能得知操作失败。

这张做法实际上取消了状态码,这是完全不可取的。正确的做法是,状态码反映发生的错误,具体的错误信息放在数据体里面返回。下面是一个例子。

API 的使用者未必知道,URL 是怎么设计的。一个解决方法就是,在回应中,给出相关链接,便于下一步操作。这样的话,用户只要记住一个 URL,就可以发现其他的 URL。这种方法叫做 HATEOAS。

上面的回应中,挑一个 URL 访问,又可以得到别的 URL。对于用户来说,不需要记住 URL 设计,只要从 api.github.com 一步步查找就可以了。

HATEOAS 的格式没有统一规定,上面例子中,GitHub 将它们与其他属性放在一起。更好的做法应该是,将相关链接与其他属性分开。

四、参考链接

Original: https://www.cnblogs.com/txw1958/p/13838850.html
Author: 方倍工作室
Title: RESTful API设计规范