简体   繁体   中英

Netty Connection Limit

I am developing an application server that is using netty 3.6.5. I would like to first understand the full meaning of the option backlog. Also why is there no documentation about the serverbootstrap options to help we developers.

My other question is how best I can limit the number of concurrent connections to the server for better performance.

Thank you.

To limit the number of concurrent connections to your server - on a UNIX system - you can set the ulimit on file descriptors before running the application, and, once all descriptors are open, other clients will be unable to connect.

To get the number of allowed file descriptors, exec $ ulimit -n as the user running the process. See man ulimit for more info.

See zhqauke's answer regarding ServerBootstrap.

  1. I found some doc in netty source code related to options in ServerBootstrap, you can find it here , in the "Configuring Channel" part.
  2. Once a client connected to the server, a new connection is established, so the number of connection is decided by the number of clients, you cannot limit the connection number. However, you can set how many worker threads should run in server side to serve these connections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM