跳至內容
主選單
主選單
移至側邊欄
隱藏
導覽
首頁
近期變更
隨機頁面
MediaWiki說明
Gea-Suan Lin's Wiki
搜尋
搜尋
登入
個人工具
登入
檢視 Oltpbenchmark 的原始碼
頁面
討論
臺灣正體
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
閱讀
檢視原始碼
檢視歷史
工具
工具
移至側邊欄
隱藏
操作
閱讀
檢視原始碼
檢視歷史
一般
連結至此的頁面
相關變更
特殊頁面
頁面資訊
←
Oltpbenchmark
由於以下原因,您無權編輯此頁面:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
{{Lowercase}} '''oltpbenchmark'''是一套[[Java]]寫的資料庫效能測試程式。 == 環境 == 這篇所提到的設定主要是在Ubuntu 18.04下的[[Kubernetes]]([[Docker]])內的情境。 == 安裝 == 先安裝並且設定需要的軟體: <syntaxhighlight lang="bash"> sudo apt install -y ant default-jdk openjdk-8-jdk git locales tzdata update-alternatives --config java # Use Java 8 </syntaxhighlight> 取得並且編譯: <syntaxhighlight lang="bash"> cd ~ git clone https://github.com/oltpbenchmark/oltpbench.git cd ~/oltpbench ant clean ant </syntaxhighlight> == 設定 == <syntaxhighlight lang="bash"> cd ~/oltpbench cp config/tpcc_config_postgres.xml config/tpcc.xml vim config/tpcc.xml # Change "DBUrl", "username", and "password". </syntaxhighlight> == 測試 == 先建立表格並且產生測試資料: <syntaxhighlight lang="bash"> cd ~/oltpbench ./oltpbenchmark -b tpcc -c config/tpcc.xml --create=true ./oltpbenchmark -b tpcc -c config/tpcc.xml --load=true </syntaxhighlight> 實際測試: <syntaxhighlight lang="bash"> # 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 --line-buffered '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 --line-buffered '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 --line-buffered 'Rate limited' done) | awk '{sum += $(NF - 1); print $(NF - 1)} END {print sum / NR}' # Brute-force to run all cases: echo 2 4 8 16 32 64 128 256 512 768 | xargs -n1 | xargs -n1 -I% bash -c "sed -i -e 's/<terminals>[0-9]*/<terminals>%/' config/tpcc.xml; echo %; (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)} END {print sum / NR}'" </syntaxhighlight> == 調整 == 在<code>tpcc.xml</code>內的<code>terminals</code>參數可以調整,以產生足夠多的client模擬測試。 == 其他 == === CockroachDB === {{See also|CockroachDB}} 如果以[[PostgreSQL]]的界面測試[[CockroachDB]]時,會因為CockroachDB不支援<code>CONSTRAINT</code>指到沒有index的欄位,會需要修改PostgreSQL產生表格時的設定,並且重新編譯: <syntaxhighlight lang="bash"> cd ~/oltpbench sed -i -e 's/^ALTER TABLE /-- ALTER TABLE/' src/com/oltpbenchmark/benchmarks/tpcc/ddls/tpcc-postgres-ddl.sql # Then rebuild oltpbenchmark: cd ~/oltpbench ant clean ant </syntaxhighlight> 另外CockroachDB只支援<code>SERIALIZE</code>模式,所以<code>tpcc.xml</code>內也修改成<code>TRANSACTION_SERIALIZABLE</code>: <syntaxhighlight lang="bash"> cd ~/oltpbench sed -i -e 's/TRANSACTION_READ_COMMITTED/TRANSACTION_SERIALIZABLE/' config/tpcc.xml </syntaxhighlight> == 外部連結 == * {{Official|https://github.com/oltpbenchmark/oltpbench}} * [https://www.notion.so/gslin/How-to-use-oltpbenchmark-32c1bb0b235041e595274f5af403da6b How to use oltpbenchmark] [[Category:軟體]]
此頁面使用了以下模板:
Template:DISPLAYTITLE
(
檢視原始碼
)
Template:Lowercase
(
檢視原始碼
)
Template:Official
(
檢視原始碼
)
Template:Official website
(
檢視原始碼
)
Template:See also
(
檢視原始碼
)
Template:Trim
(
檢視原始碼
)
Module:Arguments
(
檢視原始碼
)
Module:Hatnote
(
檢視原始碼
)
Module:Official website
(
檢視原始碼
)
Module:See also
(
檢視原始碼
)
Module:TableTools
(
檢視原始碼
)
Module:URL
(
檢視原始碼
)
返回到「
Oltpbenchmark
」。
切換限制內容寬度