「Oltpbenchmark」:修訂間差異

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


 如果以[[PostgreSQL]]的界面測試[[CockroachDB]]時,會因為CockroachDB不支援<code>CONSTRAINT</code>指到沒有index的欄位,會需要修改PostgreSQL產生表格時的設定,並且重新編譯:
 如果以[[PostgreSQL]]的界面測試[[CockroachDB]]時,會因為CockroachDB不支援<code>CONSTRAINT</code>指到沒有index的欄位,會需要修改PostgreSQL產生表格時的設定,並且重新編譯:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cd ~/oltpbench
cd ~/oltpbench
行 72: 行 73:
ant
ant
</syntaxhighlight>
</syntaxhighlight>
另外CockroachDB只支援<code>SERIALIZE</code>模式,所以<code>tpcc.xml</code>內也修改成<code>TRANSACTION_SERIALIZABLE</code>。


== 外部連結 ==
== 外部連結 ==

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

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

# Filter rate data only:
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}'

其他

如果以PostgreSQL的界面測試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

另外CockroachDB只支援SERIALIZE模式,所以tpcc.xml內也修改成TRANSACTION_SERIALIZABLE

外部連結