「Oltpbenchmark」:修訂間差異

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
本頁面具有訪問限制。如果您看見此訊息,這代表您沒有訪問本頁面的權限。
行 29: 行 29:
== 測試 ==
== 測試 ==


 先建立並且產生測試資料:
 先建立 表格 並且產生測試資料:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cd ~/oltpbench
cd ~/oltpbench
行 36: 行 36:
</syntaxhighlight>
</syntaxhighlight>


 測試:
  實際 測試:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Test it:
# Test it:

於 2018年12月31日 (一) 05:00 的修訂

oltpbenchmark是一套Java寫的資料庫效能測試程式。

安裝

先下載:

sudo apt install -y ant default-jdk openjdk-8-jdk git locales tzdata
cd ~
git clone https://github.com/oltpbenchmark/oltpbench.git

編譯:

cd ~/oltpbench
ant clean
ant

設定

cd ~/oltpbench
cp config/tpcc_config_postgres.xml config/tpcc.xml
vim config/tpcc.xml
# Change "DBUrl", "username", and "password".

測試

先建立表格並且產生測試資料:

cd ~/oltpbench
./oltpbenchmark -b tpcc -c config/tpcc.xml --create=true
./oltpbenchmark -b tpcc -c config/tpcc.xml --load=true

實際測試:

# Test it:
cd ~/oltpbench
./oltpbenchmark -b tpcc -c config/tpcc.xml --execute=true

# Just need data:
cd ~/oltpbench
./oltpbenchmark -b tpcc -c config/tpcc.xml --execute=true | grep 'Rate limited'

# Do benchmark 100 times:
cd ~/oltpbench
for i in {1..100}; do
  ./oltpbenchmark -b tpcc -c config/tpcc.xml --execute=true 2>&1 | grep 'Rate limited'
done

# Get average result:
cd ~/oltpbench
(for i in {1..100}; do
  ./oltpbenchmark -b tpcc -c config/tpcc.xml --execute=true 2>&1 | grep 'Rate limited'
done) | awk '{sum += $(NF - 1); print $(NF - 1)} END {print sum / NR}'

其他

如果測試CockroachDB時,會因為CockroachDB不支援CONSTRAINT指到沒有index的欄位,會需要修改PostgreSQL產生表格時的設定,並且重新編輯:

cd ~/oltpbench
vim src/com/oltpbenchmark/benchmarks/tpcc/ddls/tpcc-postgres-ddl.sql
# Remove all "ALTER TABLE ... ADD CONSTRAINT ..." entries near the end of the file.

# Then rebuild oltpbenchmark:
cd ~/oltpbench
ant clean
ant

外部連結