溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何理解RGW性能監(jiān)控及源碼實現(xiàn)

發(fā)布時間:2021-11-24 15:04:32 來源:億速云 閱讀:117 作者:柒染 欄目:云計算

如何理解RGW性能監(jiān)控及源碼實現(xiàn),很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

1    
性能計數(shù)器實現(xiàn)  

性能計數(shù)器啟動過程

#src/rgw/rgw_main.cc
int main(int argc, const char **argv)
    ...
  if (g_conf->daemonize) {
    global_init_daemonize(g_ceph_context);
  }
  Mutex mutex("main");
  SafeTimer init_timer(g_ceph_context, mutex);
  init_timer.init();
  mutex.Lock();
  init_timer.add_event_after(g_conf->rgw_init_timeout, new C_InitTimeout);
  mutex.Unlock();

  // Enable the perf counter before starting the service thread
  g_ceph_context->enable_perf_counter();
    ...
  r = rgw_perf_start(g_ceph_context); #啟用rgw計數(shù)器

性能計數(shù)器參數(shù)說明

#src/rgw/rgw_common.cc
int rgw_perf_start(CephContext *cct)
{
  PerfCountersBuilder plb(cct, cct->_conf->name.to_str(), l_rgw_first, l_rgw_last);

  plb.add_u64_counter(l_rgw_req, "req", "Requests"); #處理成功請求數(shù)量
  plb.add_u64_counter(l_rgw_failed_req, "failed_req", "Aborted requests"); #處理失敗請求數(shù)量

  plb.add_u64_counter(l_rgw_get, "get", "Gets"); #GET請求數(shù)量
  plb.add_u64_counter(l_rgw_get_b, "get_b", "Size of gets");
  plb.add_time_avg(l_rgw_get_lat, "get_initial_lat", "Get latency");
  plb.add_u64_counter(l_rgw_put, "put", "Puts"); #PUT請求數(shù)量
  plb.add_u64_counter(l_rgw_put_b, "put_b", "Size of puts");
  plb.add_time_avg(l_rgw_put_lat, "put_initial_lat", "Put latency");

  plb.add_u64(l_rgw_qlen, "qlen", "Queue length");
  plb.add_u64(l_rgw_qactive, "qactive", "Active requests queue");

  plb.add_u64_counter(l_rgw_cache_hit, "cache_hit", "Cache hits"); #用于緩存RGW元數(shù)據(jù)的緩存命中次數(shù)
  plb.add_u64_counter(l_rgw_cache_miss, "cache_miss", "Cache miss"); #未命中次數(shù)

  plb.add_u64_counter(l_rgw_keystone_token_cache_hit, "keystone_token_cache_hit", "Keystone token cache hits");
  plb.add_u64_counter(l_rgw_keystone_token_cache_miss, "keystone_token_cache_miss", "Keystone token cache miss");

  perfcounter = plb.create_perf_counters();
  cct->get_perfcounters_collection()->add(perfcounter);
  return 0;
}

性能計數(shù)器類型定義如下

#src/rgw/rgw_common.cc
enum {
  l_rgw_first = 15000,
  l_rgw_req,
  l_rgw_failed_req,

  l_rgw_get,
  l_rgw_get_b,
  l_rgw_get_lat,

  l_rgw_put,
  l_rgw_put_b,
  l_rgw_put_lat,

  l_rgw_qlen,
  l_rgw_qactive,

  l_rgw_cache_hit,
  l_rgw_cache_miss,

  l_rgw_keystone_token_cache_hit,
  l_rgw_keystone_token_cache_miss,

  l_rgw_last,
};
2    
如何使用計數(shù)器  

方式1

root@demo# ceph --admin-daemon /var/run/ceph-client.radosgw.en-zone1.asok perf dump
{
"cct": {
   "total_workers": 32,
   "unhealthy_workers": 0
},
"client.radosgw.en-zone1": {
   "req": 2,
   "failed_req": 2,
   "get": 0,
   "get_b": 0,
   "get_initial_lat": {
       "avgcount": 0,
       "sum": 0.000000000
   },
   "put": 0,
   "put_b": 0,
   "put_initial_lat": {
       "avgcount": 0,
       "sum": 0.000000000
   },
   "qlen": 0,
   "qactive": 0,
   "cache_hit": 0,
   "cache_miss": 2,
   "keystone_token_cache_hit": 0,
   "keystone_token_cache_miss": 0
}

方式2 (使用Dumpling以上版本)

root@demo# ceph daemon client.radosgw.en-zone1 perf dump
{
   "cct": {
       "total_workers": 32,
       "unhealthy_workers": 0
   },
   "client.radosgw.en-zone1": {
       "req": 2,
       "failed_req": 2,
       "get": 0,
       "get_b": 0,
       "get_initial_lat": {
           "avgcount": 0,
           "sum": 0.000000000
       },
       "put": 0,
       "put_b": 0,
       "put_initial_lat": {
           "avgcount": 0,
           "sum": 0.000000000
       },
       "qlen": 0,
       "qactive": 0,
       "cache_hit": 0,
       "cache_miss": 2,
       "keystone_token_cache_hit": 0,
       "keystone_token_cache_miss": 0
   }

性能計數(shù)器一般人可能不太關(guān)注,但是將計數(shù)器數(shù)據(jù)推送到一些監(jiān)控系統(tǒng)里面,同時添加一些告警策略,能夠顯著提升運維質(zhì)量。同時通過源碼層面去擴(kuò)展計數(shù)器類型,從ceph內(nèi)部去實現(xiàn)一些自定義數(shù)據(jù)的統(tǒng)計,也是一個不錯的功能亮點。

看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注億速云行業(yè)資訊頻道,感謝您對億速云的支持。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

rgw
AI