Using the RGW service’s main() as an entry point, you can view the entire FastCGI initialization process as follows

#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(); Call RGWFCGXFrontend init()Copy the code

The init() method builds an RGWFCGXProcess and passes in rgw_thread_pool_size as an argument.

#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; }};Copy the code

The default rgw_thread_POOL_size is 100, and the code definition is as follows

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

Max_connections =num_threads + (num_threads >> 3) by default max_connections=100+1=101 This is also mentioned in the code comments to ensure that as many requests as possible are processed.

#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);
};
Copy the code

So num_threads controls the number of max_connections. If you want to increase the maximum number of concurrent requests for a single RGW process, you need to increase rGW_thread_pool_size.