溫馨提示×

溫馨提示×

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

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

怎么用fastcgi模式提高RGW并發(fā)數(shù)

發(fā)布時間:2021-12-30 16:28:50 來源:億速云 閱讀:133 作者:iii 欄目:云計算

這篇文章主要介紹“怎么用fastcgi模式提高RGW并發(fā)數(shù)”,在日常操作中,相信很多人在怎么用fastcgi模式提高RGW并發(fā)數(shù)問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”怎么用fastcgi模式提高RGW并發(fā)數(shù)”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

以rgw服務的main()為入口,查看整個fastcgi的初始化過程,代碼如下

#src/rgw/rgw_main.cc
int main(int argc, const char **argv)
    if (framework == "fastcgi" || framework == "fcgi") {
      RGWProcessEnv fcgi_pe = { store, &rest, olog, 0 };

      fe = new RGWFCGXFrontend(fcgi_pe, config);

    dout(0) << "starting handler: " << fiter->first << dendl;
    int r = fe->init(); #調(diào)用RGWFCGXFrontend的init()方法

再看init()方法構(gòu)建了一個RGWFCGXProcess,并將rgw_thread_pool_size作為實參傳遞進去。

#src/rgw/rgw_frontend.h
class RGWFCGXFrontend : public RGWProcessFrontend {
public:
  RGWFCGXFrontend(RGWProcessEnv& pe, RGWFrontendConfig* _conf)
    : RGWProcessFrontend(pe, _conf) {}

  int init() {
    pprocess = new RGWFCGXProcess(g_ceph_context, &env,
                  g_conf->rgw_thread_pool_size, conf);
    return 0;
  }
};

默認rgw_thread_pool_size為100,代碼定義如下

#src/common/config_opts.h
OPTION(rgw_thread_pool_size, OPT_INT, 100)

通過RGWFCGXProcess的構(gòu)造函數(shù)發(fā)現(xiàn)max_connections=num_threads + (num_threads >> 3),也就是說默認情況下max_connections=100+1=101,代碼注釋中也提到這是為了確保能夠盡可能多的處理請求。

#src/rgw/rgw_process.h
class RGWFCGXProcess : public RGWProcess {
    int max_connections;
public:

  /* have a bit more connections than threads so that requests are
   * still accepted even if we're still processing older requests */
  RGWFCGXProcess(CephContext* cct, RGWProcessEnv* pe, int num_threads,
         RGWFrontendConfig* _conf)
    : RGWProcess(cct, pe, num_threads, _conf),
      max_connections(num_threads + (num_threads >> 3))
    {}

  void run();
  void handle_request(RGWRequest* req);
};

所以num_threads控制著max_connections的數(shù)量,如果你想提高單個rgw進程的最大并發(fā)數(shù)量,需要調(diào)高rgw_thread_pool_size。

到此,關(guān)于“怎么用fastcgi模式提高RGW并發(fā)數(shù)”的學習就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關(guān)知識,請繼續(xù)關(guān)注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

向AI問一下細節(jié)

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

AI