forked from akopytov/sysbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
309 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,118 @@ | ||
**WARNING: Oracle support is unmaintained as of sysbench 1.0. You may | ||
want to | ||
try [sysbench 0.5](https://github.com/akopytov/sysbench/tree/0.5) | ||
instead. The corresponding code and instructions below are still in the | ||
source tree in case somebody wants to update them. Patches are always | ||
welcome! ** | ||
|
||
-------------------------------------------------------------- | ||
Oracle Build steps | ||
Oracle Build steps | ||
-------------------------------------------------------------- | ||
|
||
Using Ubuntu 14.04 - intructions dated for 21/09/2016 (Was built on AWS | ||
in an r3.xlarge These actions were done against 0.5 checkout) | ||
## 安装Oracle客户端 | ||
|
||
* Setup Oracle Instant Client - | ||
### Oracle客户端下载地址 | ||
https://www.oracle.com/database/technologies/instant-client/downloads.html | ||
|
||
The following RPM's and upload them to the server: | ||
- oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm | ||
- oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm | ||
### 使用RPM安装方式,将以下RPM上传到服务器: | ||
- oracle-instantclient19.22-basic-19.22.0.0.0-1.x86_64.rpm | ||
- oracle-instantclient19.22-devel-19.22.0.0.0-1.x86_64.rpm | ||
|
||
``` | ||
alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm | ||
alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm | ||
yum -y localinstall oracle-instantclient19.22-basic-19.22.0.0.0-1.x86_64.rpm | ||
yum -y localinstall oracle-instantclient19.22-devel-19.22.0.0.0-1.x86_64.rpm | ||
``` | ||
|
||
* Install Cuda - http://www.r-tutor.com/gpu-computing/cuda-installation/cuda7.5-ubuntu | ||
### 使用zip 安装方式 | ||
|
||
``` | ||
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb | ||
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb | ||
sudo apt-get update | ||
sudo apt-get install cuda | ||
export CUDA_HOME=/usr/local/cuda-7.5 | ||
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 | ||
PATH=${CUDA_HOME}/bin:${PATH} | ||
export PATH | ||
echo "/usr/lib/oracle/12.1/client64/lib" > /etc/ld.so.conf.d/oracle-client-12.1.conf | ||
unzip instantclient-basic-linux.x64-19.22.0.0.0dbru.zip | ||
unzip instantclient-sdk-linux.x64-19.22.0.0.0dbru.zip | ||
``` | ||
|
||
``` | ||
echo "/root/instantclient_19_22" > /etc/ld.so.conf.d/oracle-instantclient.conf | ||
ldconfig | ||
``` | ||
|
||
* Build sysbench | ||
Use the following `configure` option to build with Oracle support: | ||
## 编译&安装 Sysbench | ||
``` | ||
./configure --with-oracle="/usr/lib/oracle/12.1/client64" | ||
./autogen.sh | ||
#使用--with-oracle 支持oracle, 通过--with-oracle-includes --with-oracle-libs指定Oracle客户端路径 (如未安装mysql客户端驱动,可--without-mysql排除默认的mysql支持) | ||
#--with-oracle-libs=lib路径,如rpm安装方式,可指定为/usr/lib/oracle/19.22/client64/lib | ||
#--with-oracle-includes=include路径,如rpm安装方式,可指定为/usr/include/oracle/19.22/client64 | ||
./configure --with-oracle --with-oracle-libs=/root/instantclient_19_22 --with-oracle-includes=/root/instantclient_19_22/sdk/include --without-mysql | ||
make -j | ||
make install | ||
``` | ||
|
||
Run the following commands to allow sysbench use the full number of cores: | ||
## 验证使用 | ||
- 查看帮助信息,是否有oracle相关的选项,以及是否支持oracle | ||
```shell | ||
sysbench --help | ||
``` | ||
``` | ||
sudo sh -c 'for x in /sys/class/net/eth0/queues/rx-*; do echo ffffffff> $x/rps_cpus; done' | ||
sudo sh -c "echo 32768 > /proc/sys/net/core/rps_sock_flow_entries" | ||
sudo sh -c "echo 4096 > /sys/class/net/eth0/queues/rx-0/rps_flow_cnt" | ||
Usage: | ||
sysbench [options]... [testname] [command] | ||
Commands implemented by most tests: prepare run cleanup help | ||
General options: | ||
--threads=N number of threads to use [1] | ||
--events=N limit for total number of events [0] | ||
--time=N limit for total execution time in seconds [10] | ||
--warmup-time=N execute events for this many seconds with statistics disabled before the actual benchmark run with statistics enabled [0] | ||
--forced-shutdown=STRING number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off] | ||
--thread-stack-size=SIZE size of stack per thread [64K] | ||
--thread-init-timeout=N wait time in seconds for worker threads to initialize [30] | ||
--rate=N average transactions rate. 0 for unlimited rate [0] | ||
--report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0] | ||
--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. [] | ||
--debug[=on|off] print more debugging info [off] | ||
--validate[=on|off] perform validation checks where possible [off] | ||
--help[=on|off] print help and exit [off] | ||
--version[=on|off] print version and exit [off] | ||
--config-file=FILENAME File containing command line options | ||
--luajit-cmd=STRING perform LuaJIT control command. This option is equivalent to 'luajit -j'. See LuaJIT documentation for more information | ||
Pseudo-Random Numbers Generator options: | ||
--rand-type=STRING random numbers distribution {uniform, gaussian, pareto, zipfian} to use by default [uniform] | ||
--rand-seed=N seed for random number generator. When 0, the current time is used as an RNG seed. [0] | ||
--rand-pareto-h=N shape parameter for the Pareto distribution [0.2] | ||
--rand-zipfian-exp=N shape parameter (exponent, theta) for the Zipfian distribution [0.8] | ||
Log options: | ||
--verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3] | ||
--percentile=N percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95] | ||
--histogram[=on|off] print latency histogram in report [off] | ||
General database options: | ||
--db-driver=STRING specifies database driver to use ('help' to get list of available drivers) | ||
--db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto] | ||
--db-debug[=on|off] print database-specific debug information [off] | ||
Compiled-in database drivers: | ||
oracle - Oracle driver | ||
oracle options: | ||
--oracle-user=STRING Oracle user [SYSDBA] | ||
--oracle-password=STRING Oracle password [SYSDBA] | ||
--oracle-db=STRING Oracle database name [sbtest] | ||
Compiled-in tests: | ||
fileio - File I/O test | ||
cpu - CPU performance test | ||
memory - Memory functions speed test | ||
threads - Threads subsystem performance test | ||
mutex - Mutex performance test | ||
See 'sysbench <testname> help' for a list of options for each test. | ||
``` | ||
|
||
- 测试初始化数据 | ||
```shell | ||
# 测试初始化数据 | ||
sysbench oltp_point_select --tables=10 --table-size=10000 --db-driver=oracle --oracle-db=192.168.x.x:1521/orcl --oracle-user=XXX --oracle-password=XXX prepare | ||
|
||
# 测试Point_Select **(注意:如发生段错误(Segmentation fault),需通过--thread-stack-size指定合适线程栈大小,如 --thread-stack-size=512K)** | ||
sysbench oltp_point_select --tables=10 --table-size=10000 --db-driver=oracle --oracle-db=192.168.x.x:1521/orcl --oracle-user=XXX --oracle-password=XXX --report-interval=10 --thread-stack-size=512K run | ||
|
||
#清理测试数据 | ||
sysbench oltp_point_select --tables=10 --db-driver=oracle --oracle-db=192.168.x.x:1521/orcl --oracle-user=XXX --oracle-password=XXX cleanup | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
dnl --------------------------------------------------------------------------- | ||
dnl Macro: SB_CHECK_ORACLE | ||
dnl First check if the Oracle root directory is specified with --with-oracle. | ||
dnl Otherwise check for custom Oracle paths in --with-oracle-includes and | ||
dnl --with-oracle-libs. If some paths are not specified explicitly, try to get | ||
dnl them from oracle_config. | ||
dnl --------------------------------------------------------------------------- | ||
|
||
AC_DEFUN([SB_CHECK_ORACLE],[ | ||
AS_IF([test "x$with_oracle" != xno], [ | ||
# Check for custom Oracle root directory | ||
if test [ "x$with_oracle" != xyes -a "x$with_oracle" != xno ] | ||
then | ||
ac_cv_oracle_root=`echo "$with_oracle" | sed -e 's+/$++'` | ||
if test [ -d "$ac_cv_oracle_root/include" -a \ | ||
-d "$ac_cv_oracle_root/liboracle_r" ] | ||
then | ||
ac_cv_oracle_includes="$ac_cv_oracle_root/include" | ||
ac_cv_oracle_libs="$ac_cv_oracle_root/liboracle_r" | ||
elif test [ -x "$ac_cv_oracle_root/bin/oracle_config" ] | ||
then | ||
oracleconfig="$ac_cv_oracle_root/bin/oracle_config" | ||
else | ||
AC_MSG_ERROR([invalid Oracle root directory: $ac_cv_oracle_root]) | ||
fi | ||
fi | ||
# Check for custom includes path | ||
if test [ -z "$ac_cv_oracle_includes" ] | ||
then | ||
AC_ARG_WITH([oracle-includes], | ||
AC_HELP_STRING([--with-oracle-includes], [path to oracle header files]), | ||
[ac_cv_oracle_includes=$withval]) | ||
fi | ||
if test [ -n "$ac_cv_oracle_includes" ] | ||
then | ||
AC_CACHE_CHECK([ORACLE includes], [ac_cv_oracle_includes], [ac_cv_oracle_includes=""]) | ||
ORACLE_CFLAGS="-I$ac_cv_oracle_includes" | ||
fi | ||
# Check for custom library path | ||
if test [ -z "$ac_cv_oracle_libs" ] | ||
then | ||
AC_ARG_WITH([oracle-libs], | ||
AC_HELP_STRING([--with-oracle-libs], [path to oracle libraries]), | ||
[ac_cv_oracle_libs=$withval]) | ||
fi | ||
if test [ -n "$ac_cv_oracle_libs" ] | ||
then | ||
# Trim trailing '.libs' if user passed it in --with-oracle-libs option | ||
ac_cv_oracle_libs=`echo ${ac_cv_oracle_libs} | sed -e 's/.libs$//' \ | ||
-e 's+.libs/$++'` | ||
AC_CACHE_CHECK([ORACLE libraries], [ac_cv_oracle_libs], [ac_cv_oracle_libs=""]) | ||
save_LDFLAGS="$LDFLAGS" | ||
save_LIBS="$LIBS" | ||
LDFLAGS="-L$ac_cv_oracle_libs -lclntsh -Wl,-rpath=$ac_cv_oracle_libs" | ||
LIBS="" | ||
ORA_LIBS="$LDFLAGS $LIBS" | ||
LIBS="$save_LIBS" | ||
LDFLAGS="$save_LDFLAGS" | ||
fi | ||
AC_DEFINE([USE_ORACLE], 1, | ||
[Define to 1 if you want to compile with ORACLE support]) | ||
USE_ORACLE=1 | ||
AC_SUBST([ORA_LIBS]) | ||
AC_SUBST([ORACLE_CFLAGS]) | ||
SAVE_CFLAGS="${CFLAGS}" | ||
CFLAGS="${CFLAGS} ${ORACLE_CFLAGS}" | ||
]) | ||
CFLAGS="${SAVE_CFLAGS}" | ||
AM_CONDITIONAL([USE_ORACLE], test "x$with_oracle" != xno) | ||
AC_SUBST([USE_ORACLE]) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (C) 2005 MySQL AB | ||
# Copyright (C) 2005-2008 Alexey Kopytov <akopytov@gmail.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
noinst_LIBRARIES = libsboracle.a | ||
|
||
libsboracle_a_SOURCES = drv_oracle.c | ||
libsboracle_a_CPPFLAGS = $(ORACLE_CFLAGS) $(AM_CPPFLAGS) |
Oops, something went wrong.