Benchmarks
Aerospike C用戶端函數庫附帶了一個benchmark工具,是使用C用戶端函數庫建構。 利用這個benchmark工具,能夠:
- 以特定的讀取比率向資料庫寫入資料與讀取資料。
- 改變用戶端線程數,模拟用戶端并發情況。
- 從用戶端的角度觀察延遲的分布。
在可以使用benchmark工具之前,需要安裝“開發包”及其先決條件要求的包。
建構benchmark工具:
$ cd benchmarks
$ make
啟動工具
此指令将用預設的負載、以localhost為叢集伺服器位址啟動benchmark,簡要輸出内容如下:
$ make run
./target/benchmarks -h . -p
hosts: .
port:
namespace: test
set: testset
keys/records:
object spec: int
random values: false
minimum number of transactions: -
workload: read % write %
threads:
max throughput: unlimited
read timeout: ms
write timeout: ms
max retries:
debug: false
latency: false
shared memory: false
read replica: master
read consistency level: one
write commit level: all
-- :: INFO Read/write using records
-- :: INFO Start generator threads
-- :: INFO write(tps= timeouts= errors=) read(tps= timeouts= errors=) total(tps= timeouts= errors=)
-- :: INFO write(tps= timeouts= errors=) read(tps= timeouts= errors=) total(tps= timeouts= errors=)
-- :: INFO write(tps= timeouts= errors=) read(tps= timeouts= errors=) total(tps= timeouts= errors=)
- 随機讀取/更新的鍵是1000000個。
- 50%的讀取請求,50%的寫入請求。
更詳細的工具屬性,請使用如下指令檢視:
Benchmark示例
示例1
- 連接配接127.0.0.1:3000,使用名稱為test的namespace。
- 使用1億個鍵(鍵使用整型值,範圍1~100000000)、名稱為testbin的bin、bin值為50個字元的字元串。
- 90%的讀與10%的寫入,20個并發線程。
示例2
-
連接配接127.0.0.1:3000,使用名稱為test的namespace與名稱為demoset的set。
- 使用1百萬個鍵,1400個字元的字元串做為值。
- 80%的讀取與20%的寫入,8個并發線程。
- 限制每秒事務數為2500
- 讀寫的逾時時間50毫秒
- 顯示用戶端延遲百分比為四欄:<=1ms, >1ms, >8ms, >64ms。
來源: <http://www.aerospike.com/docs/client/c/benchmarks/>