Set the maximum number of connections that will be accepted each time around the event loop.

Synopsis

Declared in <folly/io/async/AsyncServerSocket.h>

void
setMaxAcceptAtOnce(uint32_t numConns);

Description

This provides a very coarse‐grained way of controlling how fast the AsyncServerSocket will accept connections. If you find that when your server is overloaded AsyncServerSocket accepts connections more quickly than your code can process them, you can try lowering this number so that fewer connections will be accepted each event loop iteration.

For more explicit control over the accept rate, you can also use pauseAccepting() to temporarily pause accepting when your server is overloaded, and then use startAccepting() later to resume accepting.

Parameters

Name

Description

numConns

The maximum connections to accept per event loop iteration.

Created with MrDocs