您好,登錄后才能下訂單哦!
如何理解RGW性能監控及源碼實現,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。
性能計數器啟動過程
#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計數器
性能計數器參數說明
#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"); #處理成功請求數量 plb.add_u64_counter(l_rgw_failed_req, "failed_req", "Aborted requests"); #處理失敗請求數量 plb.add_u64_counter(l_rgw_get, "get", "Gets"); #GET請求數量 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請求數量 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元數據的緩存命中次數 plb.add_u64_counter(l_rgw_cache_miss, "cache_miss", "Cache miss"); #未命中次數 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; }
性能計數器類型定義如下
#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 }
性能計數器一般人可能不太關注,但是將計數器數據推送到一些監控系統里面,同時添加一些告警策略,能夠顯著提升運維質量。同時通過源碼層面去擴展計數器類型,從ceph內部去實現一些自定義數據的統計,也是一個不錯的功能亮點。
看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注億速云行業資訊頻道,感謝您對億速云的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。