当前位置:   article > 正文

sysbench 性能测试工具 —— 筑梦之路_--threads=n number of threads to use [1]

--threads=n number of threads to use [1]
  1. sysbench测试三部曲:
  2. prepare -> run -> cleanup
  3. 帮助信息
  4. [root@localhost ~]# sysbench --help
  5. Usage:
  6. sysbench [options]... [testname] [command]
  7. Commands implemented by most tests: prepare run cleanup help
  8. General options:
  9. --threads=N number of threads to use [1]
  10. --events=N limit for total number of events [0]
  11. --time=N limit for total execution time in seconds [10]
  12. --forced-shutdown=STRING number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]
  13. --thread-stack-size=SIZE size of stack per thread [64K]
  14. --rate=N average transactions rate. 0 for unlimited rate [0]
  15. --report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
  16. --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
  17. --debug[=on|off] print more debugging info [off]
  18. --validate[=on|off] perform validation checks where possible [off]
  19. --help[=on|off] print help and exit [off]
  20. --version[=on|off] print version and exit [off]
  21. --config-file=FILENAME File containing command line options
  22. --tx-rate=N deprecated alias for --rate [0]
  23. --max-requests=N deprecated alias for --events [0]
  24. --max-time=N deprecated alias for --time [0]
  25. --num-threads=N deprecated alias for --threads [1]
  26. Pseudo-Random Numbers Generator options:
  27. --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special]
  28. --rand-spec-iter=N number of iterations used for numbers generation [12]
  29. --rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1]
  30. --rand-spec-res=N percentage of 'special' values to use (for special distribution) [75]
  31. --rand-seed=N seed for random number generator. When 0, the current time is used as a RNG seed. [0]
  32. --rand-pareto-h=N parameter h for pareto distribution [0.2]
  33. Log options:
  34. --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]
  35. --percentile=N percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
  36. --histogram[=on|off] print latency histogram in report [off]
  37. General database options:
  38. --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql]
  39. --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
  40. --db-debug[=on|off] print database-specific debug information [off]
  41. Compiled-in database drivers:
  42. mysql - MySQL driver
  43. pgsql - PostgreSQL driver
  44. mysql options:
  45. --mysql-host=[LIST,...] MySQL server host [localhost]
  46. --mysql-port=[LIST,...] MySQL server port [3306]
  47. --mysql-socket=[LIST,...] MySQL socket
  48. --mysql-user=STRING MySQL user [sbtest]
  49. --mysql-password=STRING MySQL password []
  50. --mysql-db=STRING MySQL database name [sbtest]
  51. --mysql-ssl[=on|off] use SSL connections, if available in the client library [off]
  52. --mysql-ssl-cipher=STRING use specific cipher for SSL connections []
  53. --mysql-compression[=on|off] use compression, if available in the client library [off]
  54. --mysql-debug[=on|off] trace all client library calls [off]
  55. --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]
  56. --mysql-dry-run[=on|off] Dry run, pretend that all MySQL client API calls are successful without executing them [off]
  57. pgsql options:
  58. --pgsql-host=STRING PostgreSQL server host [localhost]
  59. --pgsql-port=N PostgreSQL server port [5432]
  60. --pgsql-user=STRING PostgreSQL user [sbtest]
  61. --pgsql-password=STRING PostgreSQL password []
  62. --pgsql-db=STRING PostgreSQL database name [sbtest]
  63. Compiled-in tests:
  64. fileio - File I/O test
  65. cpu - CPU performance test
  66. memory - Memory functions speed test
  67. threads - Threads subsystem performance test
  68. mutex - Mutex performance test
  69. See 'sysbench <testname> help' for a list of options for each test.
  70. Sysbench的测试主要包括以下几个方面:
  71. 1、磁盘io性能
  72. 2、cpu性能
  73. 3、内存分配及传输速度
  74. 4、POSIX线程性能
  75. 5、调度程序性能
  76. 6、数据库性能(OLTP基准测试).
  1. 使用示例:
  2. 1.准备三个10G的文件
  3. sysbench fileio --max-requests=1000000 --num-threads=4 --file-num=3 --file- total-size=30G --file-test-mode=rndwr prepare
  4. 2.测试cpu性能
  5. sysbench --threads=4 cpu --cpu-max-prime=10000000 run
  6. 3.测试内存顺序读
  7. sysbench --threads=4 memory --memory-total-size=6G --memory-oper=read -- memory-access-mode=seq run
  8. 4.测试内存随机读
  9. sysbench --threads=4 --test=memory --memory-total-size=6G --memory- oper=read --memory-access-mode=rnd run
  10. 5.测试内存性能顺序写
  11. sysbench --threads=4 --test=memory --memory-total-size=6G --memory- oper=write --memory-access-mode=seq run
  12. 6.测试内存性能随机写
  13. sysbench --threads=4 --test=memory --memory-total-size=6G --memory-oper=write --memory-access-mode=rnd run
  14. 7.测试硬盘随机读写
  15. sysbench fileio --max-requests=1000000 --num-threads=4 --file-num=3 --file-total-size=30G --file-test-mode=rndrw run
  16. 8.测试硬盘随机读
  17. sysbench fileio --max-requests=1000000 --num-threads=4 --file-num=3 --file-total-size=30G --file-test-mode=rndrd run
  18. 9.测试硬盘随机写
  19. sysbench fileio --max-requests=1000000 --num-threads=4 --file-num=3 --file-total-size=30G --file-test-mode=rndwr run
  20. 10.测试硬盘顺序重写
  21. sysbench fileio --max-requests=1000000 --threads=4 --file-num=3 --file-total-size=30G --file-test-mode=seqrewr run
  22. 11.测试硬盘顺序读
  23. sysbench fileio --max-requests=1000000 --num-threads=4 --file-num=3 --file-total-size=30G --file-test-mode=seqrd run
  24. 12.测试硬盘性能顺序写
  25. sysbench fileio --max-requests=1000000 --num-threads=4 --file-num=3 --file-total-size=30G --file-test-mode=seqwr run
  1. 针对数据库性能的测试
  2. mysql数据库
  3. 1.创建测试库
  4. mysql> create database sysbench_test;
  5. 2.准备测试数据
  6. sysbench /usr/share/sysbench/oltp_read_write.lua --tables=3 --table_size=10000000 --mysql-user=root --mysql-password=123456 --mysql-host=192.168.80.100 --mysql-port=3306 --mysql-db=sysbench_test prepare
  7. 3.数据库测试
  8. sysbench /usr/share/sysbench/oltp_point_select.lua --tables=3 --table_size=10000000 --mysql-user=root --mysql-password=123456 --mysql-host=192.168.80.100 --mysql-port=3306 --mysql-db=sysbench_test --threads=128 --time=100 --report-interval=5 run
  9. 关注指标:
  10. response time avg:平均响应时间(后面的95%的大小可以通过–percentile=98的方式去更改)。
  11. transactions:精确的说是这一项后面的TPS,但如果使用了–skip-trx=on,这项事务数为0,需要用total number of events去除以总时间,得到tps(其实还可以分为读tps和写tps)。
  12. queries:用它除以总时间,得到吞吐量QPS。
  13. #清理数据
  14. sysbench /usr/share/sysbench/oltp_read_write.lua --tables=3 --table_size=10000000 --mysql-user=root --mysql-password=123456 --mysql-host=192.168.80.100 --mysql-port=3306 --mysql-db=sysbench_test cleanup
  15. 各个脚本的测试用途:
  16. oltp_read_write:测试数据库的总和读写tps
  17. oltp_read_only:测试数据库的只读性能
  18. oltp_delete: 测试数据库删除性能
  19. oltp_update_index:测试数据库更新索引字段等的性能
  20. oltp_insert: 测试数据库数据插入性能
  21. oltp_write_only:测试数据库的写入性能
  22. oltp_point_select:测试数据库的查询性能
  1. postgresql数据库
  2. 1.准备创建表和数据:
  3. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable prepare
  4. 2.测试数据库的只读性能,使用的是oltp_read_only模式:
  5. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_only --db-ps-mode=disable run
  6. SQL statistics:
  7. queries performed:
  8. read: 25242
  9. write: 0
  10. other: 3606
  11. total: 28848
  12. transactions: 1803 (859.40 per sec.)
  13. queries: 28848 (13750.37 per sec.)
  14. ignored errors: 0 (0.00 per sec.)
  15. reconnects: 0 (0.00 per sec.)
  16. General statistics:
  17. total time: 2.0931s
  18. total number of events: 1803
  19. Latency (ms):
  20. min: 204.65
  21. avg: 865.57
  22. max: 1312.73
  23. 95th percentile: 1191.92
  24. sum: 1560630.86
  25. 3. 测试数据库的删除性能,使用的是oltp_delete模式:
  26. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_delete --db-ps-mode=disable run
  27. SQL statistics:
  28. queries performed:
  29. read: 0
  30. write: 11506
  31. other: 9290
  32. total: 20796
  33. transactions: 20796 (16813.13 per sec.)
  34. queries: 20796 (16813.13 per sec.)
  35. ignored errors: 0 (0.00 per sec.)
  36. reconnects: 0 (0.00 per sec.)
  37. General statistics:
  38. total time: 1.2349s
  39. total number of events: 20796
  40. Latency (ms):
  41. min: 3.16
  42. avg: 51.30
  43. max: 255.24
  44. 95th percentile: 58.92
  45. sum: 1066896.74
  46. 4.测试数据库的更新索引字段的性能,使用的是oltp_update_index模式:
  47. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_update_index --db-ps-mode=disable run
  48. SQL statistics:
  49. queries performed:
  50. read: 0
  51. write: 17355
  52. other: 0
  53. total: 17355
  54. transactions: 17355 (14499.51 per sec.)
  55. queries: 17355 (14499.51 per sec.)
  56. ignored errors: 0 (0.00 per sec.)
  57. reconnects: 0 (0.00 per sec.)
  58. General statistics:
  59. total time: 1.1948s
  60. total number of events: 17355
  61. Latency (ms):
  62. min: 5.27
  63. avg: 61.99
  64. max: 244.16
  65. 95th percentile: 75.82
  66. sum: 1075762.57
  67. 5.测试数据库的更新非索引字段的性能,使用的是oltp_update_non_index模式:
  68. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_update_non_index --db-ps-mode=disable run
  69. SQL statistics:
  70. queries performed:
  71. read: 0
  72. write: 17801
  73. other: 0
  74. total: 17801
  75. transactions: 17801 (14435.25 per sec.)
  76. queries: 17801 (14435.25 per sec.)
  77. ignored errors: 0 (0.00 per sec.)
  78. reconnects: 0 (0.00 per sec.)
  79. General statistics:
  80. total time: 1.2312s
  81. total number of events: 17801
  82. Latency (ms):
  83. min: 13.85
  84. avg: 60.14
  85. max: 261.74
  86. 95th percentile: 82.96
  87. sum: 1070611.81
  88. 6.测试数据库的插入性能,使用的是oltp_insert模式:
  89. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_insert --db-ps-mode=disable run
  90. SQL statistics:
  91. queries performed:
  92. read: 0
  93. write: 19685
  94. other: 0
  95. total: 19685
  96. transactions: 19685 (16335.50 per sec.)
  97. queries: 19685 (16335.50 per sec.)
  98. ignored errors: 0 (0.00 per sec.)
  99. reconnects: 0 (0.00 per sec.)
  100. General statistics:
  101. total time: 1.2000s
  102. total number of events: 19685
  103. Latency (ms):
  104. min: 4.49
  105. avg: 52.90
  106. max: 228.04
  107. 95th percentile: 77.19
  108. sum: 1041424.34
  109. 7.测试数据库的写入性能,使用的是oltp_write_only模式:
  110. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_write_only --db-ps-mode=disable run
  111. SQL statistics:
  112. queries performed:
  113. read: 0
  114. write: 17940
  115. other: 9112
  116. total: 27052
  117. transactions: 4480 (3374.72 per sec.)
  118. queries: 27052 (20377.87 per sec.)
  119. ignored errors: 43 (32.39 per sec.)
  120. reconnects: 0 (0.00 per sec.)
  121. General statistics:
  122. total time: 1.3226s
  123. total number of events: 4480
  124. Latency (ms):
  125. min: 65.01
  126. avg: 248.24
  127. max: 702.04
  128. 95th percentile: 314.45
  129. sum: 1112124.54
  130. 8.测试数据库的综合读写TPS,使用的是oltp_read_write模式
  131. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable run
  132. SQL statistics:
  133. queries performed:
  134. read: 25004
  135. write: 7114
  136. other: 3588
  137. total: 35706
  138. transactions: 1779 (899.49 per sec.)
  139. queries: 35706 (18053.45 per sec.)
  140. ignored errors: 7 (3.54 per sec.)
  141. reconnects: 0 (0.00 per sec.)
  142. General statistics:
  143. total time: 1.9728s
  144. total number of events: 1779
  145. Latency (ms):
  146. min: 199.06
  147. avg: 854.98
  148. max: 1804.89
  149. 95th percentile: 1191.92
  150. sum: 1521010.69
  151. 9.测试数据库的综合读写TPS,使用的是oltp_read_write模式:
  152. sysbench --db-driver=pgsql --time=1 --threads=500 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable run
  153. SQL statistics:
  154. queries performed:
  155. read: 11704
  156. write: 3333
  157. other: 1677
  158. total: 16714
  159. transactions: 833 (601.84 per sec.)
  160. queries: 16714 (12075.74 per sec.)
  161. ignored errors: 3 (2.17 per sec.)
  162. reconnects: 0 (0.00 per sec.)
  163. General statistics:
  164. total time: 1.3792s
  165. total number of events: 833
  166. Latency (ms):
  167. min: 293.30
  168. avg: 731.76
  169. max: 1353.39
  170. 95th percentile: 1170.65
  171. sum: 609554.21
  172. 9.使用上面的命令,sysbench工具会根据你的指令构造出各种各样的SQL语句去更新或者查询1张测试表里的数据,同时监测出数据库的压测性能指标,最后完成压测之后,可以执行下面的cleanup命令,清理数据。
  173. sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.100 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable cleanup
  1. Oracle数据库
  2. 针对Oracle数据库的测试,sysbench需要编译安装,开启支持,默认不支持针对Oracle数据库的测试
  3. sysbench版本:0.5
  4. 1.安装依赖
  5. yum -y install make automake libtool pkgconfig libaio-devel
  6. yum -y install mariadb-devel openssl-devel
  7. yum -y install postgresql-devel
  8. 2.下载源码编译安装
  9. git clone https://github.com/akopytov/sysbench.git
  10. 或者
  11. git clone https://gitee.com/rtoax/sysbench.git
  12. ./autogen.sh
  13. ./configure
  14. make -j 6 #-j参数可加规定多少线程同时编译
  15. make install
  16. -----------------------------------------------------------------------------
  17. #附上配置的帮助信息
  18. [root@localhost sysbench]# ./configure --help
  19. `configure' configures sysbench 0.5 to adapt to many kinds of systems.
  20. Usage: ./configure [OPTION]... [VAR=VALUE]...
  21. To assign environment variables (e.g., CC, CFLAGS...), specify them as
  22. VAR=VALUE. See below for descriptions of some of the useful variables.
  23. Defaults for the options are specified in brackets.
  24. Configuration:
  25. -h, --help display this help and exit
  26. --help=short display options specific to this package
  27. --help=recursive display the short help of all the included packages
  28. -V, --version display version information and exit
  29. -q, --quiet, --silent do not print `checking ...' messages
  30. --cache-file=FILE cache test results in FILE [disabled]
  31. -C, --config-cache alias for `--cache-file=config.cache'
  32. -n, --no-create do not create output files
  33. --srcdir=DIR find the sources in DIR [configure dir or `..']
  34. Installation directories:
  35. --prefix=PREFIX install architecture-independent files in PREFIX
  36. [/usr/local]
  37. --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
  38. [PREFIX]
  39. By default, `make install' will install all the files in
  40. `/usr/local/bin', `/usr/local/lib' etc. You can specify
  41. an installation prefix other than `/usr/local' using `--prefix',
  42. for instance `--prefix=$HOME'.
  43. For better control, use the options below.
  44. Fine tuning of the installation directories:
  45. --bindir=DIR user executables [EPREFIX/bin]
  46. --sbindir=DIR system admin executables [EPREFIX/sbin]
  47. --libexecdir=DIR program executables [EPREFIX/libexec]
  48. --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
  49. --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
  50. --localstatedir=DIR modifiable single-machine data [PREFIX/var]
  51. --libdir=DIR object code libraries [EPREFIX/lib]
  52. --includedir=DIR C header files [PREFIX/include]
  53. --oldincludedir=DIR C header files for non-gcc [/usr/include]
  54. --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
  55. --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
  56. --infodir=DIR info documentation [DATAROOTDIR/info]
  57. --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
  58. --mandir=DIR man documentation [DATAROOTDIR/man]
  59. --docdir=DIR documentation root [DATAROOTDIR/doc/sysbench]
  60. --htmldir=DIR html documentation [DOCDIR]
  61. --dvidir=DIR dvi documentation [DOCDIR]
  62. --pdfdir=DIR pdf documentation [DOCDIR]
  63. --psdir=DIR ps documentation [DOCDIR]
  64. Program names:
  65. --program-prefix=PREFIX prepend PREFIX to installed program names
  66. --program-suffix=SUFFIX append SUFFIX to installed program names
  67. --program-transform-name=PROGRAM run sed PROGRAM on installed program names
  68. System types:
  69. --build=BUILD configure for building on BUILD [guessed]
  70. --host=HOST cross-compile to build programs to run on HOST [BUILD]
  71. --target=TARGET configure for building compilers for TARGET [HOST]
  72. Optional Features:
  73. --disable-option-checking ignore unrecognized --enable/--with options
  74. --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
  75. --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
  76. --enable-silent-rules less verbose build output (undo: "make V=1")
  77. --disable-silent-rules verbose build output (undo: "make V=0")
  78. --enable-dependency-tracking
  79. do not reject slow dependency extractors
  80. --disable-dependency-tracking
  81. speeds up one-time build
  82. --enable-shared[=PKGS] build shared libraries [default=yes]
  83. --enable-static[=PKGS] build static libraries [default=yes]
  84. --enable-fast-install[=PKGS]
  85. optimize for fast installation [default=yes]
  86. --disable-libtool-lock avoid locking (might break parallel builds)
  87. --enable-largefile enable large files support (default is enabled)
  88. --enable-aio enable Linux asynchronous I/O support (default is
  89. enabled)
  90. --disable-rpath do not hardcode runtime library paths
  91. --disable-largefile omit support for large files
  92. --enable-profiling Toggle profiling [default=off]
  93. --enable-coverage Toggle coverage [default=off]
  94. --disable-pedantic-warnings
  95. Toggle pedanticness [default=on]
  96. --enable-iso-pedantic-warnings
  97. Toggle iso pedanticness [default=off]
  98. --enable-unreachable Enable warnings about unreachable code [default=no]
  99. --disable-fail Turn warnings into failures [default=no]
  100. --disable-go-crazy Enables extra little warnings that might be too much
  101. [default=on]
  102. Optional Packages:
  103. --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
  104. --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
  105. --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
  106. both]
  107. --with-gnu-ld assume the C compiler uses GNU ld [default=no]
  108. --with-sysroot=DIR Search for dependent libraries within DIR
  109. (or the compiler's sysroot if not specified).
  110. --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
  111. --without-lib-prefix don't search for libraries in includedir and libdir
  112. --with-extra-ldflags additional linker flags, e.g. -all-static
  113. --with-mysql compile with MySQL support (default is enabled)
  114. --with-drizzle compile with Drizzle support (default is enabled)
  115. --with-attachsql compile with libattachsql support (default is
  116. enabled)
  117. --with-oracle compile with Oracle support (default is disabled)
  118. --with-pgsql compile with PostgreSQL support (default is
  119. disabled)
  120. --with-lua Compile with Lua scripting support (default is
  121. enabled)
  122. --with-mysql-includes path to MySQL header files
  123. --with-mysql-libs path to MySQL libraries
  124. --with-gnu-ld assume the C compiler uses GNU ld default=no
  125. --with-libdrizzle-prefix[=DIR] search for libdrizzle in DIR/include and DIR/lib
  126. --without-libdrizzle-prefix don't search for libdrizzle in includedir and libdir
  127. --with-libattachsql-prefix[=DIR] search for libattachsql in DIR/include and DIR/lib
  128. --without-libattachsql-prefix don't search for libattachsql in includedir and libdir
  129. --with-pgsql-includes path to PostgreSQL header files
  130. --with-pgsql-libs path to PostgreSQL libraries
  131. --with-debug Add debug code/turns off optimizations (yes|no)
  132. [default=no]
  133. Some influential environment variables:
  134. CC C compiler command
  135. CFLAGS C compiler flags
  136. LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
  137. nonstandard directory <lib dir>
  138. LIBS libraries to pass to the linker, e.g. -l<library>
  139. CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
  140. you have headers in a nonstandard directory <include dir>
  141. CPP C preprocessor
  142. Use these variables to override the choices made by `configure' or to help
  143. it to find libraries and programs with nonstandard names/locations.
  144. Report bugs to <sysbench-developers@lists.launchpad.net>.
  145. --------------------------------------------------------------------------------
  146. 3.Oracle数据库相关操作
  147. #配置扩展源
  148. wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  149. #配置oracle数据库源
  150. wget -O /etc/yum.repos.d/Oracle.repo http://public-yum.oracle.com/public-yum-ol7.repo
  151. #安装依赖包
  152. yum install -y oracle-database-preinstall-19c
  153. #安装数据库,需上传rpm
  154. rpm -ivh oracle-database-ee-19c*.rpm
  155. #配置,创建数据库
  156. /etc/init.d/oracledb_ORCLCDB-19c configure
  157. 注:RPM安装默认的数据文件路径是/opt/oracle/oradata目录,确保空间充足
  158. #切换用户
  159. su -oracle
  160. #添加环境变量
  161. cat >> ~/.bashrc << EOF
  162. export ORACLE_BASE=/opt/oracle
  163. export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
  164. export ORACLE_SID=ORCLCDB
  165. export PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
  166. EOF
  167. source /home/oracle/.bash_profile
  168. #测试
  169. sqlplus / as sysdba
  170. #创建用户
  171. CREATE USER c##sysbench IDENTIFIED BY 123456789;
  172. #给用户授权
  173. GRANT CONNECT, RESOURCE, DBA TO c##sysbench;
  174. 2.编译支持oracle的sysbench
  175. #开启oracle支持,关闭mysql
  176. ./configure –with-oracle –libdir=/opt/oracle/product/19c/dbhome_1/lib –without-mysql
  177. #加上oracle的动态库
  178. make ORA_LIBS=/opt/oracle/product/19c/dbhome_1/lib/libclntsh.so
  179. #安装
  180. make install
  181. #查看帮助信息中是否已经支持oracle
  182. sysbench –help
  183. 3.使用示例
  184. #准备
  185. sysbench --test=oltp --db-driver=oracle --oltp_tables_count=8 --oltp-table-size=100000 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx prepare
  186. #压力测试
  187. sysbench --test=oltp --db-driver=oracle --oltp-tables-count=8 --oltp-table-size=100000 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx --max-time=900 --max-requests=10000000 --num-threads=40 --report-interval=10 run
  188. #清理数据
  189. sysbench --test=oltp --db-driver=oracle --oltp_tables_count=8 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx cleanup

参考资料:

Oracle 数据库 sysbench 压力测试 - 杨哥哥 - 博客园

sysbench安装及压测MySQL、Oracle_鹏老板的博客-CSDN博客_sysbench安装

sysbench对oracle进行压力测试 - monkey6 - 博客园

使用sysbench 压测 - 懒~人 - 博客园

sysbench压测Oracle(安装与使用示例)_51CTO博客_sysbench测试oracle

MySQL性能压测工具SysBench详解(非常详细)_mysql sysbench_林凡尘coding的博客-CSDN博客

sysbench mysql 基准测试 - 简书 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/519018
推荐阅读
相关标签
  

闽ICP备14008679号