rgw的rgw_thread_pool_size配置調整


前言

在比對rgw的不同前端的區別的時候,官方說civetweb是通過線程池來控制連接的,beast是后面加入了流控相關的,這塊一直也沒有調整過相關的參數,然后通過ab壓測了一下,還是有很明顯的區別的

測試很簡單,虛擬機下面就可以完成

測試過程

rgw_thread_pool_size = 512
默認參數為這個

[root@lab201 ~]# ps -ef|grep radosgw
root      242156  239377  0 11:42 pts/1    00:00:02 tailf /var/log/ceph/ceph-client.radosgw1.log
ceph      247068       1  3 11:53 ?        00:00:00 /usr/bin/radosgw -f --cluster ceph --name client.radosgw1 --setuser ceph --setgroup ceph
root      247654  234613  0 11:53 pts/0    00:00:00 grep --color=auto radosgw
[root@lab201 ~]# cat /proc/247068/status|grep Thread
Threads:	579

啟動rgw進程后可以去查看這個進程的線程數目,基本接近設置值的,還有一些其它需要用的線程

我們往s3接口里面傳輸一個很小的文件 260 bytes的文件,讓這個文件可以公共訪問,然后使用ab去並發連接這個文件,這里不是去看整個集群的負載多大,而是看下在相同的環境情況下,參數的改變會有什么區別

ab測試

ab -c 1000 -n 50000 http://192.168.0.201:7481/test/index.txt

1000個並發請求50000次
測試輸出

Percentage of the requests served within a certain time (ms)
  50%    180
  66%    186
  75%    193
  80%    198
  90%    214
  95%   1182
  98%   1205
  99%   2019
 100%   7589 (longest request)

我們調整rgw_thread_pool_size = 128再測試一輪

基本無法完成測試

[root@lab204 ~]# ab -c 1000 -n 50000 http://192.168.0.201:7481/test/index.txt
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.0.201 (be patient)
Completed 5000 requests
Completed 10000 requests
apr_socket_recv: Connection reset by peer (104)
Total of 14351 requests completed

我們再加大參數配置rgw_thread_pool_size = 1024

[root@lab204 ~]# ab -c 1000 -n 50000 http://192.168.0.201:7481/test/index.txt
Percentage of the requests served within a certain time (ms)
  50%    281
  66%    286
  75%    290
  80%    293
  90%    299
  95%    305
  98%    310
  99%    313
 100%   1309 (longest request)

可以看到與512線程的時候明顯的有所改善了

基於以上可以看到,線程如果設置小了,而外部的請求的並發連接大了,可能出現服務不響應的情況,而適當的加大線程數,也能一定程度上改善請求的效果,上面的測試僅測試驗證參數的影響,而實際落地到真實環境,還需要慢慢調整

luminous版本的beast也是需要調整上面的線程池的參數來應對超多連接的情況的,否則客戶端很容易就異常了

客戶端並發請求最大值調整

[root@lab204 ~]# ab -c 3000 -n 50000 http://192.168.0.201:7481/test/index.txt
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.0.201 (be patient)
socket: Too many open files (24)

默認的為1024,需要調整下參數

[root@lab204 ~]# ulimit -n 4096

調整后就可以加大並發請求了

變更記錄

Why Who When
創建 武漢-運維-磨渣 2020-09-11


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM