Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netty Connection Limit

Tags:

java

netty

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.

like image 569
Arsene Avatar asked Oct 17 '25 01:10

Arsene


2 Answers

  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.
like image 139
zhquake Avatar answered Oct 18 '25 14:10

zhquake


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.

like image 37
Nino Walker Avatar answered Oct 18 '25 15:10

Nino Walker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!