引言
ceph自從到了L版本以后,L版本的啟用,對性能本身有了極大的提高,一直對這個比較不放心的就是內存的占用,剛開始的時候記得大量dd就可以把內存搞崩掉,這個應該是內部的設計邏輯需要更多的內存的占用
最近在做ARM版本的服務器的測試,機器為36盤位的機器,內存需要自然多,但是36盤位的機器,按之前想法是4G預留,那得需要144G內存了,這個還沒有算遷移的時候的內存消耗,而很多時候,我們並不需要速度,只需要穩定就好
測試環境說明
測試環境比較簡單,一台36盤位的arm機器,一台X86機器,通過萬兆相連,設置集群為副本1,然后再X86上面通
限制前后對比
我們先按默認的來一組測試
用讀取命令進行測試
rados -p rbd -t 64 bench 300 seq --run-name 4Mt16
···
2019-09-03 15:19:20.478841 min lat: 0.188154 max lat: 0.658198 avg lat: 0.227437
sec Cur ops started finished avg MB/s cur MB/s last lat(s) avg lat(s)
20 63 5620 5557 1111.24 1124 0.223682 0.227437
21 63 5901 5838 1111.84 1124 0.232894 0.2274
22 63 6179 6116 1111.84 1112 0.210126 0.227447
23 63 6459 6396 1112.19 1120 0.209931 0.227353
24 63 6742 6679 1113.01 1132 0.210041 0.227428
25 63 7023 6960 1113.44 1124 0.447199 0.227417
26 63 7302 7239 1113.54 1116 0.213757 0.227367
27 63 7585 7522 1114.19 1132 0.222248 0.227416
28 63 7870 7807 1115.08 1140 0.198665 0.227351
29 63 8148 8085 1114.97 1112 0.222645 0.227402
30 63 8430 8367 1115.4 1128 0.205243 0.227394
31 63 8707 8644 1115.16 1108 0.22508 0.227397
32 63 8987 8924 1115.31 1120 0.198234 0.227326
33 63 9267 9204 1115.41 1120 0.232074 0.227447
34 63 9551 9488 1115.99 1136 0.230373 0.227413
35 63 9829 9766 1115.88 1112 0.214755 0.227405
36 63 10107 10044 1115.77 1112 0.233391 0.227403
37 63 10390 10327 1116.18 1132 0.223244 0.227412
38 63 10673 10610 1116.6 1132 0.221128 0.22742
···
通過top看下內存占用
Tasks: 526 total, 1 running, 237 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.6 us, 1.5 sy, 0.0 ni, 95.3 id, 1.5 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 13316204+total, 31199616 free, 10079264+used, 1169792 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 21086208 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
43967 ceph 20 0 4176384 3.1g 26624 S 1.3 2.4 0:08.79 ceph-osd
43890 ceph 20 0 4116992 3.0g 26688 S 1.0 2.4 0:08.69 ceph-osd
43753 ceph 20 0 4091712 3.0g 26752 S 2.3 2.4 0:08.88 ceph-osd
43873 ceph 20 0 4160000 3.0g 26688 S 2.0 2.4 0:08.77 ceph-osd
43998 ceph 20 0 4275776 3.0g 26688 S 2.3 2.4 0:08.91 ceph-osd
43716 ceph 20 0 4128960 3.0g 26688 S 2.3 2.3 0:08.95 ceph-osd
43899 ceph 20 0 3911232 3.0g 26688 S 1.7 2.3 0:08.44 ceph-osd
44022 ceph 20 0 4133120 3.0g 26752 S 2.0 2.3 0:09.29 ceph-osd
43617 ceph 20 0 4100608 2.9g 26688 S 2.6 2.3 0:09.13 ceph-osd
43868 ceph 20 0 4110016 2.9g 26688 S 2.6 2.3 0:08.70 ceph-osd
43792 ceph 20 0 4095552 2.9g 26752 S 2.3 2.3 0:09.02 ceph-osd
43985 ceph 20 0 4090368 2.9g 26624 S 2.3 2.3 0:08.84 ceph-osd
43707 ceph 20 0 4177472 2.9g 26624 S 2.3 2.3 0:08.79 ceph-osd
44028 ceph 20 0 4084288 2.9g 26624 S 2.3 2.3 0:08.93 ceph-osd
43995 ceph 20 0 4092480 2.8g 26688 S 2.3 2.2 0:08.95 ceph-osd
43852 ceph 20 0 4054528 2.8g 26752 S 3.6 2.2 0:08.75 ceph-osd
44038 ceph 20 0 3966528 2.8g 26688 S 2.6 2.2 0:08.51 ceph-osd
43755 ceph 20 0 4092096 2.8g 26752 S 3.0 2.2 0:09.10 ceph-osd
43718 ceph 20 0 4045376 2.8g 26688 S 1.3 2.2 0:08.84 ceph-osd
43901 ceph 20 0 3931648 2.7g 26688 S 1.7 2.2 0:08.67 ceph-osd
43880 ceph 20 0 4028992 2.7g 26688 S 2.6 2.1 0:08.82 ceph-osd
43897 ceph 20 0 3978752 2.7g 26624 S 2.3 2.1 0:08.59 ceph-osd
43858 ceph 20 0 4019776 2.7g 26560 S 1.3 2.1 0:08.89 ceph-osd
可以看到內存占用還是很可觀的,我128G內存,基本要吃空了,內存需要的太大,還出現了無法分配內存的情況,我們限制下我們的內存
限制osd內存的參數
默認值為
osd_memory_target = 4294967296
我們限制到1G
osd_memory_target = 1073741824
設置好了后重啟下所有的osd
再來一輪測試
同樣的命令
2019-09-03 15:28:41.369259 min lat: 0.189981 max lat: 0.88615 avg lat: 0.227472
sec Cur ops started finished avg MB/s cur MB/s last lat(s) avg lat(s)
40 63 11232 11169 1116.67 1116 0.221146 0.227472
41 63 11513 11450 1116.85 1124 0.22655 0.227467
42 63 11794 11731 1117.01 1124 0.213789 0.227451
43 63 12073 12010 1116.98 1116 0.21521 0.227447
44 63 12353 12290 1117.05 1120 0.232574 0.227455
45 63 12632 12569 1117.02 1116 0.217199 0.227449
46 63 12917 12854 1117.52 1140 0.211747 0.227425
47 63 13194 13131 1117.31 1108 0.229418 0.227473
48 63 13476 13413 1117.52 1128 0.229639 0.227456
49 63 13756 13693 1117.57 1120 0.228479 0.22745
50 63 14041 13978 1118 1140 0.21689 0.227463
51 63 14316 14253 1117.64 1100 0.23947 0.227468
52 63 14599 14536 1117.92 1132 0.215251 0.227452
53 63 14880 14817 1118.03 1124 0.227617 0.227461
54 63 15160 15097 1118.05 1120 0.224964 0.227449
55 63 15442 15379 1118.22 1128 0.219148 0.227451
56 63 15721 15658 1118.18 1116 0.223736 0.227459
57 63 16001 15938 1118.21 1120 0.23183 0.227468
58 63 16282 16219 1118.3 1124 0.217697 0.227465
59 63 16566 16503 1118.6 1136 0.217804 0.227465
查看修改后的內存占用
top - 15:29:10 up 4:54, 6 users, load average: 1.88, 2.74, 2.25
Tasks: 506 total, 1 running, 239 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.2 us, 0.9 sy, 0.0 ni, 97.4 id, 0.0 wa, 0.0 hi, 0.4 si, 0.0 st
KiB Mem : 13316204+total, 12275264+free, 9211264 used, 1198144 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 11264793+avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
48575 ceph 20 0 908544 262144 26688 S 2.0 0.2 0:09.71 ceph-osd
48547 ceph 20 0 904448 252800 26752 S 1.0 0.2 0:09.36 ceph-osd
48480 ceph 20 0 902336 247552 26624 S 1.3 0.2 0:09.11 ceph-osd
48485 ceph 20 0 906048 242048 26688 S 1.7 0.2 0:09.38 ceph-osd
48423 ceph 20 0 901312 241984 26688 S 1.3 0.2 0:09.62 ceph-osd
48534 ceph 20 0 896576 234752 26688 S 1.3 0.2 0:09.22 ceph-osd
48395 ceph 20 0 902656 231360 26688 S 2.0 0.2 0:08.96 ceph-osd
48474 ceph 20 0 899584 225920 26624 S 1.3 0.2 0:09.07 ceph-osd
48369 ceph 20 0 891456 223232 26688 S 1.3 0.2 0:09.31 ceph-osd
48375 ceph 20 0 899648 222016 26624 S 1.7 0.2 0:08.72 ceph-osd
48365 ceph 20 0 885312 220928 26688 S 1.3 0.2 0:09.06 ceph-osd
48421 ceph 20 0 899200 218944 26688 S 1.7 0.2 0:09.31 ceph-osd
48478 ceph 20 0 889344 218496 26880 S 1.3 0.2 0:09.46 ceph-osd
48347 ceph 20 0 879104 218112 26688 S 1.7 0.2 0:08.52 ceph-osd
48515 ceph 20 0 891456 215680 26688 S 2.0 0.2 0:09.21 ceph-osd
48465 ceph 20 0 884224 214336 26688 S 1.7 0.2 0:08.82 ceph-osd
48560 ceph 20 0 892480 214144 26624 S 1.3 0.2 0:08.87 ceph-osd
48552 ceph 20 0 900992 213952 26752 S 1.7 0.2 0:09.32 ceph-osd
48599 ceph 20 0 890432 213760 26624 S 2.0 0.2 0:09.19 ceph-osd
48613 ceph 20 0 882176 213056 26752 S 1.0 0.2 0:09.12 ceph-osd
48430 ceph 20 0 893440 212672 26688 S 1.7 0.2 0:09.18 ceph-osd
48503 ceph 20 0 885312 211456 26688 S 2.3 0.2 0:09.52 ceph-osd
48444 ceph 20 0 889408 211200 26752 S 2.0 0.2 0:09.60 ceph-osd
48635 ceph 20 0 898624 210944 26688 S 2.0 0.2 0:09.26 ceph-osd
48526 ceph 20 0 898624 210752 26816 S 2.6 0.2 0:09.20 ceph-osd
48491 ceph 20 0 898368 210304 26816 S 2.3 0.2 0:09.57 ceph-osd
可以看到內存控的好好的,並且在這個場景下面,我們的性能並沒有太多的損失,基本一致的,因為我的環境是單萬兆的,輸出的網絡帶寬是小於底層磁盤可以提供的帶寬的,這個情況下磁盤的占用也就沒那么滿
這個也是我在做配置的時候推薦的一點,各項資源不要打的那么滿,對於帶寬場景來說,多留幾個磁盤的輸出冗余,那么在出現一些異常的時候,底層也不會影響到那么大
總結
本篇通過一個參數的介紹,講述了osd的內存的占用的控制,一般情況來說,默認的參數已經足夠好了,當然你在很確定你修改的參數會影響什么的情況下,可以根據需要做一些調整,如果在你的IO模型下面,你調整了都看不到效果,那還是不動為好
我們手上有高性能的arm,就是上面的這款測試用到的,有32個processor,內存最大可以支持到
Maximum Capacity: 512 GB
Number Of Devices: 16
盤位的機箱我們有能力自己設計,也就是可以根據需要進行定制,有需要的可以找我
變更記錄
| Why | Who | When |
|---|---|---|
| 創建 | 武漢-運維-磨渣 | 2018-09-03 |
