如何理解RGW性能監(jiān)控及源碼實現(xiàn),很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。
成都創(chuàng)新互聯(lián)是專業(yè)的石龍網(wǎng)站建設(shè)公司,石龍接單;提供成都做網(wǎng)站、網(wǎng)站建設(shè),網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進行石龍網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!
性能計數(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, };
方式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ì)量。同時通過源碼層面去擴展計數(shù)器類型,從ceph內(nèi)部去實現(xiàn)一些自定義數(shù)據(jù)的統(tǒng)計,也是一個不錯的功能亮點。
看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識有進一步的了解或閱讀更多相關(guān)文章,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)的支持。