|
|
概述" M7 P( W1 A+ L( t8 l8 N
Ceph的配置参数很多,从网上也能搜索到一大批的调优参数,但这些参数为什么这么设置?设置为这样是否合理?解释的并不多
* M( O7 L( R* [/ W* {$ D; a本文从当前我们的ceph.conf文件入手,解释其中的每一项配置,做为以后参数调优和新人学习的依据;" m5 L/ n, P2 x) S/ [
参数详解" O$ X. [+ R$ I
1,一些固定配置参数( p/ @. G( z: d8 g6 @
3 k/ k$ _" V9 m1 F; efsid = 6d529c3d-5745-4fa5-be5f-3962a8e8687c
, Q7 X1 U( B i- l! }8 qmon_initial_members = mon1, mon2, mon38 U, e7 q* s0 Y/ S
mon_host = 10.10.40.67,10.10.40.68,10.10.40.692 G, O0 I" C E3 G! K: ^6 y7 l& @
以上通常是通过ceph-deploy生成的,都是ceph monitor相关的参数,不用修改;9 y; P3 ~! q: L" _! S' b/ s
2,网络配置参数
8 C5 D/ [- B* r
; I; k& l: }' a* S9 rpublic_network = 10.10.40.0/24 默认值 ""$ q# G1 j% {2 f0 o# c9 V# w
cluster_network = 10.10.41.0/24 默认值 ""
; `9 m5 i# e$ N* b" b6 E0 t' W% S) npublic network:monitor与osd,client与monitor,client与osd通信的网络,最好配置为带宽较高的万兆网络;
4 s# w3 t |' m$ D3 x. W; Q- Qcluster network:OSD之间通信的网络,一般配置为带宽较高的万兆网络;9 n4 P0 ] m/ F5 `+ ]
参考:1 [+ p# F$ Y f5 y
http://docs.ceph.com/docs/master/rados/configuration/network-config-ref/$ n% o+ N2 a6 a6 M
3,pool size配置参数 c7 o% ?8 u! \; }& v) `) Y
/ W8 T$ \, Y8 ]- n' |
osd_pool_default_size = 3 默认值 3
) M! x: q$ u, U7 L% {: ]4 Yosd_pool_default_min_size = 1 默认值 0 // 0 means no specific default; ceph will use size-size/2 H. x( D0 m3 |
这两个是创建ceph pool的时候的默认size参数,一般配置为3和1,3副本能足够保证数据的可靠性;
$ e- |' {/ L0 b! `3 ?$ O4,认证配置参数7 L) E- z( q! W! ]+ u3 i3 _0 S. h
1 v S% n; M B: {auth_service_required = none 默认值 "cephx"
9 ?- k4 e3 F! b; q# Eauth_client_required = none 默认值 "cephx, none"1 l* i3 W& ]6 F* n! W, A
auth_cluster_required = none 默认值 "cephx"- l1 o# ^/ y+ c+ c) L3 j4 _9 d
以上是Ceph authentication的配置参数,默认值为开启ceph认证;; C1 Z2 e1 X4 W# ^4 n- R
在内部使用的ceph集群中一般配置为none,即不使用认证,这样能适当加快ceph集群访问速度;
! {3 @9 K; p' u; [* J, ~( O! S5,osd down out配置参数
2 B9 z @/ t7 ~, C- S P# d( O/ t' U/ m+ X4 I, ?! _
mon_osd_down_out_interval = 864000 默认值 300 // seconds. ^ {. k4 \! ~# ~. T
mon_osd_min_down_reporters = 2 默认值 2( \ J5 J; w: U+ t/ u R3 t& r
mon_osd_report_timeout = 900 默认值 900
1 N! u$ L( M1 b3 ~( W2 Zosd_heartbeat_interval = 15 默认值 6" f% P2 h2 e* g F
osd_heartbeat_grace = 60 默认值 207 b! J& Y" R) [8 ]
mon_osd_down_out_interval:ceph标记一个osd为down and out的最大时间间隔
! V7 |- u+ n% q; {/ l2 @/ pmon_osd_min_down_reporters:mon标记一个osd为down的最小reporters个数(报告该osd为down的其他osd为一个reporter)1 u8 _6 b+ I5 @$ q
mon_osd_report_timeout:mon标记一个osd为down的最长等待时间
z" h4 J) E) e" ~! _( Aosd_heartbeat_interval:osd发送heartbeat给其他osd的间隔时间(同一PG之间的osd才会有heartbeat)
' c- X+ s+ \6 L7 d. Q1 J! cosd_heartbeat_grace:osd报告其他osd为down的最大时间间隔,grace调大,也有副作用,如果某个osd异常退出,等待其他osd上报的时间必须为grace,在这段时间段内,这个osd负责的pg的io会hang住,所以尽量不要将grace调的太大。
. {* ^0 }" c3 D1 `基于实际情况合理配置上述参数,能减少或及时发现osd变为down(降低IO hang住的时间和概率),延长osd变为down and out的时间(防止网络抖动造成的数据recovery);7 R, {8 _% f" M* x3 Y, W
参考:5 u& T/ _2 \( @0 x+ q
http://docs.ceph.com/docs/master/rados/configuration/mon-osd-interaction/
# d. A5 A) S- ]5 n- ~$ |http://blog.wjin.org/posts/ceph-osd-heartbeat.html1 Q5 ^) C' V) {& c1 Q3 W3 W3 L4 W3 y& o4 ?
6,objecter配置参数
" Q: q- {, `9 N& h3 q i- U
* e: o) F" B4 Pobjecter_inflight_ops = 10240 默认值 1024
3 \$ }; ?: g. k; m* |objecter_inflight_op_bytes = 1048576000 默认值 100M8 C( v8 g7 N, B, t% w3 Q5 J
osd client端objecter的throttle配置,它的配置会影响librbd,RGW端的性能;0 k! B+ F" r% z5 U' S. [- L
配置建议:
6 n4 f( f& B+ u7 R/ {( e调大这两个值
, N# n# v. e5 f7,ceph rgw配置参数
% V! s, T/ N; ~* K5 {+ n: e( N( ?& d% `$ d& Z" y6 p) F. i
rgw_frontends = "civetweb port=10080 num_threads=2000" 默认值 "fastcgi, civetweb port=7480"8 z; x+ |' v" V+ [. c
rgw_thread_pool_size = 512 默认值 100! w2 v- t9 ]2 m, H6 g
rgw_override_bucket_index_max_shards = 20 默认值 0! \, b5 C8 w1 r K# u# u
3 ?. }7 A& G ~7 C8 Y
rgw_max_chunk_size = 1048576 默认值 512 * 1024' _% E" T' c1 G: K
rgw_cache_lru_size = 1000000 默认值 10000 // num of entries in rgw cache/ }( U% h, P% p& \
rgw_bucket_default_quota_max_objects = 10000000 默认值 -1 // number of objects allowed( U/ N) f1 f5 o& T8 X
, o5 a3 ?7 ?: F3 `rgw_dns_name = object-storage.ffan.com 默认值; g' W' n% f/ x( K2 e$ a. B
rgw_swift_url = http://object-storage.ffan.com 默认值
( M5 }' a& }0 X. q1 {rgw_frontends:rgw的前端配置,一般配置为使用轻量级的civetweb;prot为访问rgw的端口,根据实际情况配置;num_threads为civetweb的线程数;
; Y& M; A- _. ~- i! x! ?rgw_thread_pool_size:rgw前端web的线程数,与rgw_frontends中的num_threads含义一致,但num_threads 优于rgw_thread_pool_size的配置,两个只需要配置一个即可;! ]- n+ X- S& j; E
rgw_override_bucket_index_max_shards:rgw bucket index object的最大shards数,增大这个值能减少bucket index object的访问时间,但也会加大bucket的ls时间;
/ e6 V3 O" s1 f% brgw_max_chunk_size:rgw最大chunk size,针对大文件的对象存储场景可以把这个值调大;
" g6 Y$ r% B) Frgw_cache_lru_size:rgw的lru cache size,对于读较多的应用场景,调大这个值能加快rgw的响应速度;$ w) ?% K. z0 f }9 B1 [0 I/ C' W0 S' }
rgw_bucket_default_quota_max_objects:配合该参数限制一个bucket的最大objects个数;
8 s% v8 B7 c9 p3 \* x& v$ I参考: a, T1 Q- J6 Q
http://docs.ceph.com/docs/jewel/install/install-ceph-gateway/
5 `: ?* I$ _. T0 r+ Z* Shttp://ceph-users.ceph.narkive.com/mdB90g7R/rgw-increase-the-first-chunk-size9 Q o8 X7 C- c2 B3 e' F
https://access.redhat.com/solutions/2122231
+ K, m. P& o0 u9 t3 j% P8,debug配置参数
: s# t0 S* \7 K5 x0 D& l9 Q. {) f% C. u2 p6 {# W* j; F/ ~& i2 @( D9 s
debug_lockdep = 0/0
3 V. z# q. P7 w) x: i8 adebug_context = 0/0
- c9 { R. u; }3 ~: ~" Hdebug_crush = 0/05 t$ o* n( x* V8 A
debug_buffer = 0/0 x) @' f/ l4 x m$ C! v
debug_timer = 0/0
: m/ }# Y' U# y$ z4 {debug_filer = 0/05 x. T3 j. r/ X2 r* l6 ~* l% S9 K$ n
debug_objecter = 0/0( `* K8 Z H' g3 \
debug_rados = 0/04 C. u/ {4 M( R& ]9 E
debug_rbd = 0/0" w- I* L4 g; C$ ?
debug_journaler = 0/0% `! i+ w. u& T# C
debug_objectcatcher = 0/0
8 O, p+ x$ J7 Zdebug_client = 0/0
/ s; `: e! x* m' ^% ^debug_osd = 0/0
% ]: A" {3 V- n, Ndebug_optracker = 0/0
: k: A8 g o" P% _* V) f8 adebug_objclass = 0/0+ _4 q: U) }9 D. \+ P" t/ ~ D; Z
debug_filestore = 0/0( V4 r2 ^; m: A3 O; _; k1 j" B
debug_journal = 0/0
; Z, w: C* E! V$ w4 A* z) idebug_ms = 0/0
9 G/ P' i- g" I! D: ?debug_mon = 0/0
* C3 @' \0 ^7 V. q/ Xdebug_monc = 0/0
( l, u, z8 l8 Z- E, Kdebug_tp = 0/0
4 s9 `) @2 ^0 {. a2 ^( h' q' Vdebug_auth = 0/0
9 p. r% {/ \* D3 s0 zdebug_finisher = 0/0. M& n7 b5 M! o4 J0 M6 a
debug_heartbeatmap = 0/03 Z2 O, D$ K5 E+ v- ~
debug_perfcounter = 0/0; H' T' m" f$ J; P' c& Z3 N. s* x
debug_asok = 0/0" h* a& L! \! t3 h: j# K# S/ K
debug_throttle = 0/0: j; x M# ^. w" c: {, g
debug_paxos = 0/0
) q) \5 R, T2 ?$ x5 x7 C: ]debug_rgw = 0/0
# }9 m3 n. z1 B! S1 U5 s关闭了所有的debug信息,能一定程度加快ceph集群速度,但也会丢失一些关键log,出问题的时候不好分析;& U+ E- M3 i7 K$ T
参考:" R6 O6 C. u% C* `. a1 h3 x
http://www.10tiao.com/html/362/201609/2654062487/1.html+ T2 | u' }& m2 {; }% ^6 D
9,osd op配置参数. n5 u5 v: n* W( k' e3 G
+ u: I8 z- L) r& i+ P# W- `osd_enable_op_tracker = false 默认值 true
2 `% C R3 V7 C2 L$ w; Zosd_num_op_tracker_shard = 32 默认值 32
+ V6 a6 @( e* x G+ Bosd_op_threads = 10 默认值 2
, y9 x% V: ?! B7 ^: ^$ _% iosd_disk_threads = 1 默认值 1* x/ J5 F% \4 Q1 F4 q
osd_op_num_shards = 32 默认值 50 L r; t/ ?* u2 T; u% x
osd_op_num_threads_per_shard = 2 默认值 2
: p: [) P# c; l) Wosd_enable_op_tracker:追踪osd op状态的配置参数,默认为true;不建议关闭,关闭后osd的 slow_request,ops_in_flight,historic_ops 无法正常统计;
9 m3 y* P$ o4 d
* i) _( o1 W9 d1 Y8 Q3 U# ceph daemon /var/run/ceph/ceph-osd.0.asok dump_ops_in_flight- p4 |+ ]8 m3 u+ s% q. W
op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. Please enable "osd_enable_op_tracker", and the tracker will start to track new ops received afterwards.- F5 [4 |# ]- O7 M7 B
# ceph daemon /var/run/ceph/ceph-osd.0.asok dump_historic_ops4 x; s- t& ?1 w% c, W
op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. Please enable "osd_enable_op_tracker", and the tracker will start to track new ops received afterwards.
5 m1 S& G, d5 ]9 ^' B- \: e打开op tracker后,若集群iops很高,osd_num_op_tracker_shard可以适当调大,因为每个shard都有个独立的mutex锁;$ l/ t; V* X& j5 |# g
2 I2 V: E- r2 Y0 |0 C* X4 d' M3 W
class OpTracker {; o: s! {8 m0 I8 L9 s V
...& v4 ~! E8 x E2 Y# G
struct ShardedTrackingData {
- n# \$ g X2 @6 e4 x# k Mutex ops_in_flight_lock_sharded;
, R' p" M+ B J1 L# Y6 `/ _' D xlist<TrackedOp *> ops_in_flight_sharded;6 f U, ]5 E' H: u
explicit ShardedTrackingData(string lock_name):
4 X- s9 g# N% Q& [ G) q ops_in_flight_lock_sharded(lock_name.c_str()) {}
4 {0 G7 m$ v3 Y( s9 F/ ?) X };* u0 l: w0 R+ ?/ ]
vector<ShardedTrackingData*> sharded_in_flight_list;3 K- S8 Q- }. ^0 {! k8 a J9 X
uint32_t num_optracker_shards;% j5 y' D3 p5 i3 u; f4 y% x# h
...
. ?4 d$ y# c# C1 x% S- C4 L4 m};
& c2 W' |) S& G: D2 G- z( p0 oosd_op_threads:对应的work queue有peering_wq(osd peering请求),recovery_gen_wq(PG recovery请求);8 I9 O% x. Y- R- o5 B% l
osd_disk_threads:对应的work queue为 remove_wq(PG remove请求);7 i/ Q- W% H R' B; v
osd_op_num_shards和osd_op_num_threads_per_shard:对应的thread pool为osd_op_tp,work queue为op_shardedwq;+ E2 N- @" J, b' s6 J% \# Q
处理的请求包括:6 s( S- R2 t' X
OpRequestRef" ~* B+ ]5 @6 J6 L$ S6 b# g
PGSnapTrim! d2 \* R+ q9 t1 o
PGScrub
( I0 L: Q4 G# }4 q1 M: d6 f, Y调大osd_op_num_shards可以增大osd ops的处理线程数,增大并发性,提升OSD性能;
# E# t1 Q4 m) h7 e6 G10,osd client message配置参数
% T. l& K2 @5 R% G# B1( ~" Y4 o5 S' J% ~
2
# D& R [2 P" a6 H' l8 @( Kosd_client_message_size_cap = 1048576000 默认值 500*1024L*1024L // client data allowed in-memory (in bytes)+ Y# J! M9 {+ c/ F: ]% L5 r
osd_client_message_cap = 10000 默认值 100 // num client messages allowed in-memory, Q( p# j1 M. G3 s. O x9 J" ]% S# ]
这个是osd端收到client messages的capacity配置,配置大的话能提升osd的处理能力,但会占用较多的系统内存;
( O! `' ^" J h" @+ B配置建议:
! ?/ K* ~3 g, ]( q服务器内存足够大的时候,适当增大这两个值
( O8 m4 b' |! T11,osd scrub配置参数6 I* ^0 S" K. @7 \6 e: Y
6 x3 T$ ]* s) g1 ~1 [6 Q: `
osd_scrub_begin_hour = 2 默认值 0
8 i: m( Q+ o- E( Nosd_scrub_end_hour = 6 默认值 24; V4 q' k2 i" Q7 D2 o- j5 G2 M
@. O2 b! N6 k* L$ L5 P5 J
// The time in seconds that scrubbing sleeps between two consecutive scrubs) |/ u$ R4 J- G4 U
osd_scrub_sleep = 2 默认值 0 // sleep between [deep]scrub ops" H1 x/ q$ h' T) A
! V% Q( p8 `4 R, C8 ]osd_scrub_load_threshold = 5 默认值 0.5
1 F3 ]: H8 T" {% n, L+ \- `
/ v2 Z* N0 ]2 ]// chunky scrub配置的最小/最大objects数,以下是默认值6 {/ C; m( w' q3 u/ M1 R
osd_scrub_chunk_min = 5+ c3 C5 C3 M" }8 H/ u4 L
osd_scrub_chunk_max = 25
8 S: L! u0 {) h. A* J) P6 ZCeph osd scrub是保证ceph数据一致性的机制,scrub以PG为单位,但每次scrub回获取PG lock,所以它可能会影响PG正常的IO;
4 W% b1 S4 d# H* ]Ceph后来引入了chunky的scrub模式,每次scrub只会选取PG的一部分objects,完成后释放PG lock,并把下一次的PG scrub加入队列;这样能很好的减少PG scrub时候占用PG lock的时间,避免过多影响PG正常的IO;. B# L$ n7 b- ]* s @
同理,引入的osd_scrub_sleep参数会让线程在每次scrub前释放PG lock,然后睡眠一段时间,也能很好的减少scrub对PG正常IO的影响;" i/ ~% p1 X" u( Z
配置建议:' M0 u" D) i k
osd_scrub_begin_hour和osd_scrub_end_hour:OSD Scrub的开始结束时间,根据具体业务指定;, B( ?7 o: l. k/ P
osd_scrub_sleep:osd在每次执行scrub时的睡眠时间;有个bug跟这个配置有关,建议关闭;
3 O4 f" H" L4 Q% sosd_scrub_load_threshold:osd开启scrub的系统load阈值,根据系统的load average值配置该参数;9 x; v, E4 k. z4 r0 p2 H
osd_scrub_chunk_min和osd_scrub_chunk_max:根据PG中object的个数配置;针对RGW全是小文件的情况,这两个值需要调大;. O4 n: }+ g4 B- c4 e+ s6 Q
参考:
9 z$ Y9 n- d- f, _& U7 H3 Khttp://www.jianshu.com/p/ea2296e1555c
: c; L1 `. f& h1 `! t( nhttp://tracker.ceph.com/issues/19497
, x5 y4 o9 A" Y0 E12,osd thread timeout配置参数
! E/ A" k$ h- C \ ^
) J4 d: i y: o4 f% @' Josd_op_thread_timeout = 580 默认值 151 R" K# t! a5 s' g. D2 w9 K
osd_op_thread_suicide_timeout = 600 默认值 150
) R9 k! ? M$ s' Z% I
0 [5 b! _5 o% l0 I5 ]. Sosd_recovery_thread_timeout = 580 默认值 30
0 M: L0 e# l1 S' c$ [7 @osd_recovery_thread_suicide_timeout = 600 默认值 300
/ l( ?5 K( N9 I& G. Aosd_op_thread_timeout和osd_op_thread_suicide_timeout关联的work queue为:
& r- `: n1 Y9 f( B. rop_shardedwq - 关联的请求为:OpRequestRef,PGSnapTrim,PGScrub5 Q. y& V& j7 f% U+ X @
peering_wq - 关联的请求为:osd peering
1 ]2 ~ E+ W$ \6 v4 v' D5 qosd_recovery_thread_timeout和osd_recovery_thread_suicide_timeout关联的work queue为:$ i1 O, x" s) z' o; w
recovery_wq - 关联的请求为:PG recovery) N5 q: G6 M. f9 L. Z
Ceph的work queue都有个基类WorkQueue_,定义如下:
$ P& _6 m7 X" X" E; H' T- J" ]2 @+ g" ?% F- P3 [1 i
/// Pool of threads that share work submitted to multiple work queues.
; A( M8 ^% F) k8 Z. p3 aclass ThreadPool : public md_config_obs_t {
1 v1 \1 Q2 `$ K: f5 Z...! r0 Z+ u. m; U9 Y0 H% w4 N
/// Basic interface to a work queue used by the worker threads. K! I8 M6 F7 E0 v
struct WorkQueue_ {) |$ b) _+ A2 v/ ]
string name;$ i R0 L5 h. e( r$ }
time_t timeout_interval, suicide_interval;/ o9 C9 W' U! A& g% u, n
WorkQueue_(string n, time_t ti, time_t sti)5 o) P5 Q; ?$ U- j! Q8 N- ]
: name(n), timeout_interval(ti), suicide_interval(sti)
8 J% N9 u; N: w* F' H! L { }; f4 D" o; d/ E5 M/ j
...
4 ?. S5 |% Z* i- E% m8 d这里的timeout_interval和suicide_interval分别对应上面所述的配置timeout和suicide_timeout;
4 u( Z# T2 c& `" \* ]当thread处理work queue中的一个请求时,会受到这两个timeout时间的限制:4 j1 q. l+ @2 m5 a# Q6 E) y, M& F
timeout_interval - 到时间后设置m_unhealthy_workers+1$ n# r* v2 i4 ?
suicide_interval - 到时间后调用assert,OSD进程crush
* M9 T& z2 W9 x% b对应的处理函数为:
# R! M5 V5 J8 j2 @# l& S" I" F3 \/ A6 s
bool HeartbeatMap::_check(const heartbeat_handle_d *h, const char *who, time_t now)! U2 g5 J. d" G# j8 v
{
9 {1 J9 J+ K; r9 z bool healthy = true;
- M6 J" N) ~& c { time_t was;
' ~$ M$ O5 d$ w" V* }6 h3 h was = h->timeout.read();7 i4 ?6 N7 a1 V O0 H
if (was && was < now) {
, ^0 Y- q. V+ m' v" L; u8 n ldout(m_cct, 1) << who << " '" << h->name << "'"
) v# n& i' J& M) g << " had timed out after " << h->grace << dendl;- i$ ?7 F Q" Y! f! P1 K5 J6 l* i* h: ]
healthy = false;7 @" n' m5 b/ L2 ?1 k3 e+ c1 u
}3 k+ }* J, O" P% Z& t, i
was = h->suicide_timeout.read();
" m7 o2 l. _+ |, S- u: Q. q& }* } if (was && was < now) {3 m g! x: t! \$ L2 B
ldout(m_cct, 1) << who << " '" << h->name << "'"
0 f( h) r0 M- t) R << " had suicide timed out after " << h->suicide_grace << dendl;( H( j3 ~( N( |
assert(0 == "hit suicide timeout");
# u1 m. Q5 @/ S( ?) P. R7 Z8 V; k }5 ]% e. {8 C, V0 Y
return healthy;+ l7 |; T [ h, g7 p
}, y* O- ]" S: M/ ^
当前仅有RGW添加了worker的perfcounter,所以也只有RGW可以通过perf dump查看total/unhealthy的worker信息:5 s% y3 W7 q9 N6 v" ?% u8 ~
4 {9 X# R2 |+ W+ Q/ D[root@ yangguanjun]# ceph daemon /var/run/ceph/ceph-client.rgw.rgwdaemon.asok perf dump | grep worker
( `- ?/ t0 y, {+ A "total_workers": 32,
$ i3 T3 l5 q6 @# E$ M# { "unhealthy_workers": 07 M7 @7 z/ D) @) n( |, r5 d
对应的配置项为:4 r3 R, d% R! m, U l) ?/ q( R: Y2 M
* B; L4 b9 h/ l1 ~0 Z' f) W$ h
OPTION(rgw_num_async_rados_threads, OPT_INT, 32) // num of threads to use for async rados operations* Y3 }; q& u* n$ Q+ I
``` , C! f0 S' `. T Y2 y% m! `
**配置建议:**8 M9 p' F8 `1 i, v8 v2 o
- `*_thread_timeout`:这个值配置越小越能及时发现处理慢的请求,所以不建议配置很大;特别是针对速度快的设备,建议调小该值;5 k% n( w2 O$ X
- `*_thread_suicide_timeout`:这个值配置小了会导致超时后的OSD crush,所以建议调大;特别是在对应的throttle调大后,更应该调大该值;7 p4 m0 R" p4 ^( t5 J' i
### 13,fielstore op thread配置参数* i/ o8 c4 B/ h' S
```sh
* R3 N8 f3 Q, H4 ]$ _/ x7 |. tfilestore_op_threads = 10 默认值 2
' E" p2 M( L* g( U1 Zfilestore_op_thread_timeout = 580 默认值 60
1 { w* H, i. I' g( k8 z2 ?9 A6 pfilestore_op_thread_suicide_timeout = 600 默认值 1806 i& P: {3 c& @2 E" U% }
filestore_op_threads:对应的thread pool为op_tp,对应的work queue为op_wq;filestore的所有请求都经过op_wq处理;
* D4 r' s1 ]+ v! L增大该参数能提升filestore的处理能力,提升filestore的性能;配合filestore的throttle一起调整;/ D1 J; A2 `" W! A
filestore_op_thread_timeout和filestore_op_thread_suicide_timeout关联的work queue为:op_wq
1 b8 Y5 N# x6 Z* v l. i配置的含义与上一节中的thread_timeout/thread_suicide_timeout保持一致;
' l% A! _% L3 }' _. L# A13,filestore merge/split配置参数
4 Y% K( e( q" u2 M8 c2 p3 E( n% n
4 A7 w8 `( l/ j6 K/ k7 H4 ]filestore_merge_threshold = -1 默认值 10* _8 ]8 Y* p7 G/ ] ?1 P
filestore_split_multiple = 16000 默认值 2
H4 X6 ?9 ^# v9 Z4 H- n这两个参数是管理filestore的目录分裂/合并的,filestore的每个目录允许的最大文件数为:
8 j2 B' g( S% h& l2 kfilestore_split_multiple * abs(filestore_merge_threshold) * 16: g& r+ X. R! X. H2 T
在RGW的小文件应用场景,会很容易达到默认配置的文件数(320),若在写的过程中触发了filestore的分裂,则会非常影响filestore的性能;
1 C' E' {) J2 A, ]每次filestore的目录分裂,会依据如下规则分裂为多层目录,最底层16个子目录:
9 J. G$ K8 _" U7 f0 M X例如PG 31.4C0, hash结尾是4C0,若该目录分裂,会分裂为 DIR_0/DIR_C/DIR_4/{DIR_0, DIR_F};+ [7 W7 a' [$ G( x3 }8 ^
原始目录下的object会根据规则放到不同的子目录里,object的名称格式为: *__head_xxxxX4C0_*,分裂时候X是几,就放进子目录DIR_X里。比如object:*__head_xxxxA4C0_*, 就放进子目录 DIR_0/DIR_C/DIR_4/DIR_A 里;
o4 x! a# h% B z解决办法:
X7 d9 l1 E5 N4 }, a( Z增大merge/split配置参数的值,使单个目录容纳更多的文件;8 B( L8 t9 P6 A7 f3 l
filestore_merge_threshold配置为负数;这样会提前触发目录的预分裂,避免目录在某一时间段的集中分裂,详细机制没有调研;
" c3 W6 j) @) Z8 y2 e+ b创建pool时指定expected-num-objects;这样会依据目录分裂规则,在创建pool的时候就创建分裂的子目录,避免了目录分裂对filestore性能的影响;
5 K8 Z% _+ a/ }) }参考:
. Y( m1 D# N$ g! W" X+ Bhttp://docs.ceph.com/docs/master/rados/configuration/filestore-config-ref/
. N* w, x, ?) l# Ihttp://docs.ceph.com/docs/jewel/rados/operations/pools/#create-a-pool7 m) ~/ p7 u1 s; S3 m
http://blog.csdn.net/for_tech/article/details/51251936! N2 U2 l) m! u+ [1 Z
http://ivanjobs.github.io/page3/& z7 I1 B* {7 R- H" [6 A
14,filestore fd cache配置参数" z# z/ [, v1 a* X
$ y# U5 k3 I( G8 J2 P4 k' cfilestore_fd_cache_shards = 32 默认值 16 // FD number of shards
7 P% [6 F8 M$ L. r% ofilestore_fd_cache_size = 32768 默认值 128 // FD lru size
* a" ]& D& ?" t% j( y8 I$ r1 Pfilestore的fd cache是加速访问filestore里的file的,在非一次性写入的应用场景,增大配置可以很明显的提升filestore的性能;
$ R% r/ c! _$ m/ z& s- H: B15,filestore sync配置参数
# c' K. R# m8 y2 _/ V% `
* E: E3 C o$ f2 t9 \ Wfilestore_wbthrottle_enable = false 默认值 true SSD的时候建议关闭- i* c* `: c; D: ?/ o% w
filestore_min_sync_interval = 5 默认值 0.01 s 最小同步间隔秒数,sync fs的数据到disk,FileStore::sync_entry()
: m. ~ \/ e; P1 o* A8 H0 Bfilestore_max_sync_interval = 10 默认值 5 s 最大同步间隔秒数,sync fs的数据到disk,FileStore::sync_entry()
7 A5 \. P) s( n! Hfilestore_commit_timeout = 3000 默认值 600 s FileStore::sync_entry() 里 new SyncEntryTimeout(m_filestore_commit_timeout)
& J7 H; ] \5 }8 z6 I+ ]filestore_wbthrottle_enable的配置是关于filestore writeback throttle的,即我们说的filestore处理workqueue op_wq的数据量阈值;默认值是true,开启后XFS相关的配置参数有:
0 ?! ~ n. `" |
* ]9 |5 w7 q& V2 h0 @! Z' Q; a( m( L. iOPTION(filestore_wbthrottle_xfs_bytes_start_flusher, OPT_U64, 41943040)$ c2 u c' |# J% z3 ~ ~
OPTION(filestore_wbthrottle_xfs_bytes_hard_limit, OPT_U64, 419430400)4 K. x9 l8 T$ S8 H
OPTION(filestore_wbthrottle_xfs_ios_start_flusher, OPT_U64, 500): M# ?; J( \- }) J2 L
OPTION(filestore_wbthrottle_xfs_ios_hard_limit, OPT_U64, 5000): d% ~* W4 f& k6 l$ K0 J9 U* D# s
OPTION(filestore_wbthrottle_xfs_inodes_start_flusher, OPT_U64, 500)& x+ p6 Z+ }+ Z& L5 d3 O
OPTION(filestore_wbthrottle_xfs_inodes_hard_limit, OPT_U64, 5000)+ x9 g* P+ R- c! o$ R0 ^
若使用普通HDD,可以保持其为true;针对SSD,建议将其关闭,不开启writeback throttle;
6 v/ R h) x5 y- pfilestore_min_sync_interval和filestore_max_sync_interval是配置filestore flush outstanding IO到disk的时间间隔的;增大配置可以让系统做尽可能多的IO merge,减少filestore写磁盘的压力,但也会增大page cache占用内存的开销,增大数据丢失的可能性;9 A3 h# ]" N) C8 [* j3 s0 b8 K, I
filestore_commit_timeout是配置filestore sync entry到disk的超时时间,在filestore压力很大时,调大这个值能尽量避免IO超时导致OSD crush;3 Q/ U( R& d0 I) C# q, C3 c$ d
16,filestore throttle配置参数
6 |6 M5 U6 s4 x/ W9 Z% [% |9 }: h% E7 r W; ]
filestore_expected_throughput_bytes = 536870912 默认值 200MB /// Expected filestore throughput in B/s
; n/ }/ H6 L N) dfilestore_expected_throughput_ops = 2500 默认值 200 /// Expected filestore throughput in ops/s' a2 G. j$ X0 a$ ]4 {
filestore_queue_max_bytes= 1048576000 默认值 100MB
. Q2 N' ?# {" a8 E) x/ z4 pfilestore_queue_max_ops = 5000 默认值 508 u, P4 r3 D( K: x% H
3 H6 s* y! ?; z$ x$ i0 e4 n/// Use above to inject delays intended to keep the op queue between low and high ?9 C n: o% l1 H' f' O
filestore_queue_low_threshhold = 0.6 默认值 0.3
* s5 f; _8 |- p( l J8 Z$ Cfilestore_queue_high_threshhold = 0.9 默认值 0.9
# I+ [ z- \+ b+ r1 K. @ ' q+ I' z5 y2 n7 X5 h
filestore_queue_high_delay_multiple = 2 默认值 0 /// Filestore high delay multiple. Defaults to 0 (disabled)- n: H. n9 r# W$ V% H
filestore_queue_max_delay_multiple = 10 默认值 0 /// Filestore max delay multiple. Defaults to 0 (disabled)
8 \0 c% G* r, L在jewel版本里,引入了dynamic throttle,来平滑普通throttle带来的长尾效应问题;6 m. \0 L! C4 j; d5 H7 D
一般在使用普通磁盘时,之前的throttle机制即可很好的工作,所以这里默认filestore_queue_high_delay_multiple和filestore_queue_max_delay_multiple都为0;, y4 ]/ I+ o3 k
针对高速磁盘,需要在部署之前,通过小工具ceph_smalliobenchfs来测试下,获取合适的配置参数;% F' o% {) ?: I5 L" r
/ |7 Z( K. n/ v; R* @
BackoffThrottle的介绍如下:
; S/ {; C# }( | E# u/**. e& ^, v+ Z" D; p6 p- ]
* BackoffThrottle4 y. a) u& c. E* h' d7 L$ D3 H
*
2 Q; G' K5 p. C# Z' y; p/ L9 e/ t* Creates a throttle which gradually induces delays when get() is called
7 p, @; M6 ^! u: D k/ Q/ R* based on params low_threshhold, high_threshhold, expected_throughput,
2 ?$ {; v5 Q1 ^1 y4 g2 A* high_multiple, and max_multiple.
: N$ K$ M0 y' q*; G7 F: b. A# j, d" f
* In [0, low_threshhold), we want no delay.
; N7 P) p' r! Y- {% C*" H/ y+ y b4 J# [! R5 `
* In [low_threshhold, high_threshhold), delays should be injected based) _& f6 j, U8 r( T1 U5 f9 [
* on a line from 0 at low_threshhold to
2 }3 B7 q; j, u% K- S* high_multiple * (1/expected_throughput) at high_threshhold.4 [/ D+ G7 X# W- h2 I
*
" F/ ~3 i0 k F1 J: N* In [high_threshhold, 1), we want delays injected based on a line from
+ T3 p; J- e0 ^1 D8 J7 x8 X* (high_multiple * (1/expected_throughput)) at high_threshhold to
- M% \' p& } e+ Z3 l& c0 W* (high_multiple * (1/expected_throughput)) +
+ X! e2 H, D1 T: C9 V' R2 J* (max_multiple * (1/expected_throughput)) at 1.7 q5 f6 f' k: A/ B4 n
** H/ e$ z: l0 v
* Let the current throttle ratio (current/max) be r, low_threshhold be l,0 E* F, z |6 i4 i# V5 b, c- y
* high_threshhold be h, high_delay (high_multiple / expected_throughput) be e,
0 c/ s; J) r1 ]3 W$ @* p* and max_delay (max_muliple / expected_throughput) be m.
) P( `: I+ d9 d/ o4 {*
4 N0 p# W4 ]8 A' s, A* delay = 0, r \in [0, l)
2 O8 r3 \$ A. X0 d6 d* |, g ^* delay = (r - l) * (e / (h - l)), r \in [l, h)
6 U6 c" _7 i( A/ X3 y V* delay = h + (r - h)((m - e)/(1 - h))- d4 t- F6 N+ W, G" r
*/, P" e: F% |# |4 |; l4 K* O
参考:
& U# B! { M+ j; D, i) i! Zhttp://docs.ceph.com/docs/jewel/dev/osd_internals/osd_throttles/8 t" N5 [# R3 [) [- s8 A
http://blog.wjin.org/posts/ceph-dynamic-throttle.html
* F% [9 {. ]- k- L$ R. i# Fhttps://github.com/ceph/ceph/blob/master/src/doc/dynamic-throttle.txt
' J- Q! h) P7 f m( TCeph BackoffThrottle分析: b; ?) W- D6 Y1 n# D' r
17,filestore finisher threads配置参数
9 L @9 u: {" _6 p: a# ?1
0 C* X' _/ |0 ?5 t. H/ I2( g) z& u& v6 N. S
filestore_ondisk_finisher_threads = 2 默认值 1
, a8 {) C. u9 I' x# y/ Efilestore_apply_finisher_threads = 2 默认值 1 @' T/ o' V' F/ G
这两个参数定义filestore commit/apply的finisher处理线程数,默认都为1,任何IO commit/apply完成后,都需要经过对应的ondisk/apply finisher thread处理;2 |; u; Y& M9 V
在使用普通HDD时,磁盘性能是瓶颈,单个finisher thread就能处理好;
$ Y5 f4 C F# Z! ^但在使用高速磁盘的时候,IO完成比较快,单个finisher thread不能处理这么多的IO commit/apply reply,它会成为瓶颈;所以在jewel版本里引入了finisher thread pool的配置,这里一般配置为2即可;5 k, }* ?6 ^: ?3 r$ M3 D" n9 S
18,journal配置参数7 o% m) J( ]2 a
Z$ d1 q: X: k9 q7 Qjournal_max_write_bytes=1048576000 默认值 10M 7 C( Y; \/ \& i- A# F9 a. _1 Z
journal_max_write_entries=5000 默认值 1002 b4 [; f1 d+ @, e
* L V0 Q" J( {# U5 Xjournal_throttle_high_multiple = 2 默认值 0 /// Multiple over expected at high_threshhold. Defaults to 0 (disabled).
2 v0 g( c" P! W* Djournal_throttle_max_multiple = 10 默认值 0 /// Multiple over expected at max. Defaults to 0 (disabled).
) j- K/ z1 ?- j- F! ]7 B/// Target range for journal fullness/ ~/ b3 d6 X9 H2 c5 ^6 j8 @
OPTION(journal_throttle_low_threshhold, OPT_DOUBLE, 0.6)
2 t K ~9 S5 \4 H& V9 COPTION(journal_throttle_high_threshhold, OPT_DOUBLE, 0.9)
( ]7 A% n: K. d" yjournal_max_write_bytes和journal_max_write_entries是journal一次write的数据量和entries限制;5 @/ Q' X( h; M
针对SSD分区做journal的情况,这两个值要增大,这样能增大journal的吞吐量;% o1 g$ p' D4 o" V$ L, u4 c$ j
journal_throttle_high_multiple和journal_throttle_max_multiple是JournalThrottle的配置参数,JournalThrottle是BackoffThrottle的封装类,所以JournalThrottle与我们在filestore throttle介绍的dynamic throttle工作原理一样;7 A" H; i/ a9 G' }5 a' c
) H( b8 ?5 U# K2 G- g
int FileJournal::set_throttle_params()
' u$ }4 U- w+ X+ F8 K% l9 `{
5 R3 [# s. k1 ?8 w0 I' c stringstream ss;
X7 M: z" Y! c bool valid = throttle.set_params(
" M$ Y5 q) R4 z& f g_conf->journal_throttle_low_threshhold," }! ]9 S a( i1 v, W2 Q
g_conf->journal_throttle_high_threshhold,
7 }2 V/ J1 }. s3 T. k3 ~- ~0 C2 _/ J g_conf->filestore_expected_throughput_bytes,1 F# p' l/ G& T) B! R
g_conf->journal_throttle_high_multiple,
& n5 j: V0 P3 a* V g_conf->journal_throttle_max_multiple,
( w7 E( B6 o; U+ P. K header.max_size - get_top(),
4 q! Y8 T+ t6 |) x# ?# ] &ss);
, l( Z& m; B2 S' u A# B& ~4 y...
9 B; q/ Z/ A! A6 C4 T6 }}2 ?: \5 ~7 }# x$ F6 \
从上述代码中看出相关的配置参数有:
0 Q, H$ A6 n$ [8 G# t. B3 Jjournal_throttle_low_threshhold
3 }' s. G4 b5 [journal_throttle_high_threshhold
( A& z# D. N2 Pfilestore_expected_throughput_bytes
0 {7 }8 V+ l9 N) H" L; b19,rbd cache配置参数$ P( w0 {7 _2 o% \& V0 I3 L
' c( I% K7 E. ^& D$ ~
[client]
% ~; W' j# m/ y3 C1 i9 w* D- Xrbd_cache_size = 134217728 默认值 32M // cache size in bytes. u0 K' V. H/ e" E5 A7 }: G
rbd_cache_max_dirty = 100663296 默认值 24M // dirty limit in bytes - set to 0 for write-through caching
( y4 N0 |) I9 Y( mrbd_cache_target_dirty = 67108864 默认值 16M // target dirty limit in bytes
# ?7 L W3 l$ Y! _1 xrbd_cache_writethrough_until_flush = true 默认值 true // whether to make writeback caching writethrough until flush is called, to be sure the user of librbd will send flushs so that writeback is safe
. B, j' o7 t$ g# G* lrbd_cache_max_dirty_age = 5 默认值 1.0 // seconds in cache before writeback starts
+ G- E' Y4 t' M" \rbd_cache_size:client端每个rbd image的cache size,不需要太大,可以调整为64M,不然会比较占client端内存;: g/ P' r8 x- y! Y+ M
参照默认值,根据rbd_cache_size的大小调整rbd_cache_max_dirty和rbd_cache_target_dirty;
2 Z. H5 g+ C3 |' L- {% Irbd_cache_max_dirty:在writeback模式下cache的最大bytes数,默认是24MB;当该值为0时,表示使用writethrough模式; ?* G, i& |" G
rbd_cache_target_dirty:在writeback模式下cache向ceph集群写入的bytes阀值,默认16MB;注意该值一定要小于rbd_cache_max_dirty值- N' ?8 W5 J3 K# M$ ~
rbd_cache_writethrough_until_flush:在内核触发flush cache到ceph集群前rbd cache一直是writethrough模式,直到flush后rbd cache变成writeback模式;
( G% x* Q+ ^+ `/ }- `. O; lrbd_cache_max_dirty_age:标记OSDC端ObjectCacher中entry在cache中的最长时间;' c7 }9 L" y2 V: I, u
|
|