配置OLTPBenchmark并进行性能调优
安装依赖
PostgreSQL
首先安装PostgreSQL,本测试系统为Ubuntu,请参考这里。
您可以通过psql
像postgres用户sudo
一样运行单个命令来完成此操作,如下所示:
sudo -u postgres psql
这会将你直接登录到Postgres中,而不需要中间的bash
shell。
同样,您可以键入以下命令退出交互式Postgres会话:
\q
Ant的配置
首先通过通过Linux下的wget指令获取到最新的Ant包:
wget http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.10.5-bin.tar.gz
然后通过tar指令解压Ant包中的内容:
tar zxvf apache-ant-1.10.5-bin.tar.gz
最后根据解压后内容配置系统的环境变量 -->需要修改当前用户下的 .bash_profile文件中的配置:vim ~/.bash_profile
#set Java environment
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export ANT_HOME=/usr/local/apache-ant
export PATH=$PATH:${ANT_HOME}/bin:${JAVA_HOME}/bin
然后执行ant
:
安装成功!
OLTPBenchmark编译
首先git到本地:
git clone https://github.com/oltpbenchmark/oltpbench
然后进入该目录,使用ant
进行编译。
OLTPBenchmark
修改配置
编译好了,进入config:
cd config/
里面有很多样例,我们这里选择sample_pgtpcc_config.xml
进行postgreSQL的性能测试:
修改内容为(标准测试):
<?xml version="1.0"?>
<parameters>
<!-- Connection details -->
<dbtype>postgres