使用COSBench工具对ceph s3接口进行压力测试--续
之前寫的使用COSBench工具對ceph s3接口進行壓力測試是入門,在實際使用是,配置內容各不一樣,下面列出
壓力腳本是xml格式的,套用UserGuide文檔說明,如下
有很多模板的例子,在conf目錄下,如librados-config-sample.xml、s3-config-sample.xml
這里只有s3的,所以目前只關注s3的相關配置
S3的配置在頁面上選擇時沒有顯示出來,所以我們就進行手工配置
第一級workload,格式如下:
<workload name=”demo” description=”demo benchmark with mock storage” />
| 屬性 | 類型 | 默認值 | 備注 |
| Name | String | ? | 名字,隨便取 |
| Descriptipion | String | ? | 描述 |
?
對應s3就用storage參數,格式如下:
<storage type="s3" config="accesskey=<accesskey>;secretkey=<scretkey>;endpoint=<endpoint>; proxyhost=<proxyhost>;proxyport=<proxyport>" />
| 屬性 | 類型 | 默認值 | 備注 |
| Timeout | Int | 30,000 | 毫秒 |
| Accesskey | String | ? | S3 的accesskey |
| Secretkey | String | ? | S3的secretkey |
| Endpoint | String | 默認為亞馬遜地址 | ? |
| Proxyhost | String | ? | 代理地址 |
| Proxyport | Int | ? | 代理端口 |
第二級workstorage,格式如下
<workstage name="<name>" ></workstage>
| 屬性 | 類型 | 默認值 | 備注 |
| Name | String | ? | 名字,隨便取 |
對應使用work參數,格式如下
<work name="main" type="normal" workers="128" interval="5" division="none" runtime="60" rampup="0" rampdown="0" totalOps="0" totalBytes="0" afr=”200000” config="" > . . . </work>
| 屬性 | 類型 | 默認值 | 備注 |
| Name | String | ? | 名字,隨便取 |
| Type | String | “normal” | 工作類型,下面有介紹 |
| Workers | Int | ? | 并發工作數 |
| Interval | Int | 5 | 間隔時間 |
| Division | Str | “none” | 劃分數據方式,為container時,通過bucket劃分數據,為ojbect,以對像數據劃分數據,”none”時,所以的bucket都 有ojbect數據 |
| Runtime | Int | 0 | 運行時長 |
| Rampup | Int | 0 | 多長時間啟動完所有的壓力 |
| Rampdown | Int | 0 | 結束數,不能與runtime同時配 |
| totalOps | Int | 0 | 操作數 |
| totalBytes | Int | 0 | 多大bytes將傳輸 |
| Driver | Str | ? | 哪個driver將執行工作,默認的話,所有的drivers將參與工作,平分 |
| Afr | Int | 200,000 – normal 0 – special work | 可接受錯誤速率,毫秒級別 |
?
Work type支持
init(創建bucket)
格式<work type=”init” workers=”4” config=”containers=r(1,100)” />
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
prepare(在bucket中插入特定的對像)
格式
<work type=”perpare” work=”4” config=”containers-=r(1,10);objects=r(1,100);sizes=c(64)KB”/>
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
| Ojbects | String | ? | Object選擇表達式,如c(1),u(1,100) |
| Oprefix | String | Myobjects_ | 對像前綴 |
| Osuffix | String | <null> | 對像后綴 |
| Sizes | String | ? | 大小,單位可以為(B/KB/MG/GB) |
| Chuncked | Boolean | False | 校驗上傳的數據 |
| Content | String | “random”(默認) “zero” | 上傳數據內容,默認為隨機字符號 |
| Createcontainer | Boolean | False | 如果bucket不存在就創建對贏的bucket |
| hashCheck | Boolean | False | Hash檢查 |
Cleanup(刪除文件)
格式:<work type=”cleanup” workers=”4” config=”containers=r(1,5)”;objects=r(1,100)” />
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
| Ojbects | String | ? | Object選擇表達式,如c(1),u(1,100) |
| Oprefix | String | Myobjects_ | 對像前綴 |
| Osuffix | String | <null> | 對像后綴 |
| Deletecontainer | Boolean | False | 存在相關的bucket則刪除bucket |
Dispolse(刪除bucket)
格式?<work type=”dispose” workers=”4” config=”containers=r(1,100)” />
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
Delay(延遲)
用的少,不寫了
?
Operation支持:
格式<operation type=”read|write|delete” ratio=”<1-100> config=”<key>=<value>;….” />
| 參數 | 類型 | 默認值 | 說明 |
| Type | String | ? | 操作類型,只有read write delete list |
| Ratio | Int | ? | 比例 |
| Division | Int | ? | ? |
| Config | String | ? | 參數列表 |
?
read
格式<operation type=”read” ratio=”79” config=”containers=c(1);objects=u(1,100)” />
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
| Ojbects | String | ? | 對像表達式如u(1,100) |
| Oprefix | String | Myobjects_ | 對像前綴 |
| Osuffix | String | <null> | 對像后綴 |
| Hascheck | Boolean | False | 是否校驗 |
write
格式:
<operation type=”write” ratio=”20” config=”containers=c(2);objects=u(1,10);size=c(2)MB”/>
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
| objects | String | ? | 對像表達式如u(1,100) |
| Oprefix | String | Myobjects_ | 對像前綴 |
| Osuffix | String | <null> | 對像后綴 |
| Sizes | String | ? | 大小 |
| Chunked | Boolean | False | 上傳數據是否分片 |
| Content | String | “radom”(默認值) “zero” | 默認是隨機字符填充 |
| Hascheck | Boolean | False | 是否校驗 |
filewrite(文件上傳)
格式:
<operation type=”filewrite” ratio=”20” config=”containers=c(2);fileselection=s;files=/tmp”/>
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
| Fileselection | String | ? | 上傳文件選擇方式,如s |
| Files | String | ? | 目錄 |
| Chunked | Boolean | False | 上傳數據是否分片 |
| Hascheck | Boolean | False | 是否校驗 |
delete
格式<operation type=”delete” ratio=”10” config=”containers=c(2);ojbects=u(1,100)” />
| 參數 | 類型 | 默認值 | 說明 |
| Containers | String | ? | Bucket選項表達式,比如c(1),r(1,100) |
| Cprefix | String | Mycontainers_ | Bucket前綴 |
| Csuffix | String | <null> | 后綴 |
| objects | String | ? | 對像表達式如u(1,100) |
| Oprefix | String | Myobjects_ | 對像前綴 |
| Osuffix | String | <null> | 對像后綴 |
| ? | ? | ? | ? |
list(用的少)
?
在填寫參數時,還需要注意各種選擇器的使用,如下
| Expression | 格式 | 備注 |
| Constant(不變的) | C(number) | 固定在一個數值 |
| Uniform(隨機) | U(min,max) | 從[min,max]中隨機選擇一個數 |
| Range | R(min,max) | 同python里的range函數 更常用在(init,prepare,cleanup,dispose)里,不建議用在operation |
| sequential | S(min,max) | 也是增加函數,常用于operation操作中 |
| Histogram | H(min1|max1|weight1,…..) | 用在文件大小的不同比重中,實際使用少,不解釋 |
常見的xml:
初始化bucket,將會創建二個bucket
<?xml version="1.0" encoding="UTF-8" ?> - <workload name="initBucket" description="sample benchmark for s3"><storage type="s3" config="accesskey=V02TU7BTTHYSVINSRB7P;secretkey=b2u6ZgiNVlnfsDUpBigEbZKX9Na7kvM7UWEMrtPN;endpoint=http://xxx.xxx.xxx/" /> - <workflow> - <workstage name="init_create_bucket"><work type="init" workers="1" config="cprefix=test;containers=r(1,2)" /> </workstage></workflow></workload> View Code上傳特定大小的文件
在test1 bucket中上傳100個4M的文件,并發25
<?xml version="1.0" encoding="UTF-8" ?> - <workload name="put-100Workers-4MB" description="sample benchmark for s3"><storage type="s3" config="accesskey=V02TU7BTTHYSVINSRB7P;secretkey=b2u6ZgiNVlnfsDUpBigEbZKX9Na7kvM7UWEMrtPN;endpoint=http://xxx.xxx.xxx.xxx/" /> - <workflow> - <workstage name="put 4MB data with 100 workers"> - <work name="Put64KBData1" workers="25" totalOps="200" driver="sv40"><operation type="write" ratio="100" config="cprefix=test;oprefix=100wks_64k;containers=c(1);objects=s(1,100);sizes=c(4)MB" /> </work></workstage></workflow></workload> View Code讀寫1:1
<?xml version="1.0" encoding="UTF-8" ?> - <workload name="read&write" description="sample benchmark for s3"><storage type="s3" config="accesskey=7FRWOW451AM5N1BDGWG6;secretkey=Xb9YEC5ia4KbCR1M7fZgR67RFXi1ARPrOfxa9Bjx;endpoint=http://xxx.xxx.xx.xx/" /> - <workflow> - <workstage name="read &write"> - <work name="read write" workers="25" totalOps="100"><operation type="write" ratio="50" config="cprefix=test;oprefix=100wks_64k;containers=c(1);objects=s(1,10);sizes=c(50)KB" /> <operation type="read" ratio="50" config="cprefix=test-;oprefix=100wks_64kr;containers=c(1);objects=s(1,10);sizes=c(50)KB" /> </work></workstage></workflow></workload> View Code?
轉載于:https://www.cnblogs.com/landhu/p/5896829.html
總結
以上是生活随笔為你收集整理的使用COSBench工具对ceph s3接口进行压力测试--续的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: iTunesHelper.exe是什么(
- 下一篇: Eclipse中10个最有用的快捷键组合