简体   繁体   English

网络连接限制

[英]Netty Connection Limit

I am developing an application server that is using netty 3.6.5. 我正在开发一个使用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. 另外,为什么没有关于serverbootstrap选项的文档来帮助我们的开发人员。

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. 要限制与服务器的并发连接数 - 在UNIX系统上 - 您可以在运行应用程序之前在文件描述符上设置ulimit,并且一旦所有描述符都打开,其他客户端将无法连接。

To get the number of allowed file descriptors, exec $ ulimit -n as the user running the process. 要获取允许的文件描述符的数量,请运行该进程的exec $ ulimit -n See man ulimit for more info. 有关详细信息,请参阅man ulimit

See zhqauke's answer regarding ServerBootstrap. 请参阅zhqauke关于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. 我在netb源代码中找到了一些与ServerBootstrap中的选项相关的文档,您可以在“配置通道”部分找到它
  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. 但是,您可以设置应在服务器端运行多少个工作线程来为这些连接提供服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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