Node.js Express Windows Max连接设置 [英] nodejs express windows max connections setting

查看:253
本文介绍了Node.js Express Windows Max连接设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 10中在哪里设置nodejs的最大连接数(以便使用express'get)?它与linux中的最大文件(描述符)设置有关吗?该设置是否有Windows版本?最好是在nodejs中进行设置,以便在迁移到unix时兼容吗?

Where to set max connections for nodejs(for using express' get) in windows 10? Is it related to max files(descriptors) setting in linux? Is there a windows version of that setting? Preferably a setting in nodejs so it will be compatible when migrated to unix?

我怀疑当超过2000个并发连接攻击我的使用Express并将服务器保持在队列中的服务器程序的并发连接时,由于此设置,loadtest模块会由于此设置而出错,以便稍后处理.对于200个并发连接(命令行中的-c 200),负载测试通常会正常完成.另外,当我不将连接保留在队列中并且如果get中的操作很简单("response.end('hello world')")时,它不会给-c 2000错误,也许它在其他启动之前完成了工作,所以它不是2000并发,只有排队的版本具有2000并发性?

I suspect loadtest module gives error because of this setting when over 2000 concurrent connections to attack my server program that uses express and keeps connections in a queue to be processed later. Loadtest finishes normally for 200 concurrent connections(-c 200 in command line). Also when I don't keep connections in a queue and if operation in get is simple("response.end('hello world')"), it doesn't give error for -c 2000 maybe it finishes a work before other starts so its not 2000 concurrent really, only queued version has 2000 concurrency?

我没有使用http模块,但正在处理服务器端express moduleget函数上从客户端发送的xlmhttprequest.

I'm not using http module but I am handling xlmhttprequest sent from clients on serverside express module's get function.

也许台式机版Windows操作系统不是在考虑服务器应用程序的情况下开发的,所以它没有设置最大连接数,最大文件访问量和相关变量的硬编码吗?

Maybe desktop version windows os wasn't developed with server apps in mind so it doesn't have a setting for max connections, max file accesses and related variables has been hardcoded in it?

推荐答案

要回答问题的一部分,最大打开文件数为_setmaxstdio,请参见:

To answer one part of your question, for max open file there is _setmaxstdio, see:

也许您可以编写一个包装来更改它并启动Node程序.

Maybe you can write a wrapper that changes this and starts your Node program.

关于最大开放连接的一般问题,这是我发现的一些较旧的Windows:

As for the general question of max open connections, this is what I found about some older Windows:

它讨论更改以下配置:

[HKEY_LOCAL_MACHINE \System \CurrentControlSet \Services \Tcpip \Parameters]

TcpNumConnections = 0x00fffffe(默认= 16,777,214)

TcpNumConnections = 0x00fffffe (Default = 16,777,214)

[HKEY_LOCAL_MACHINE \System \CurrentControlSet \Services \Tcpip \Parameters]

MaxUserPort = 5000(默认= 5000,最大= 65534)

MaxUserPort = 5000 (Default = 5000, Max = 65534)

另请参见上面链接中的其他相关参数.我不知道配置值的名称在Windows的最新版本中是否已更改,但是如果增加打开文件的限制还不够的话,我会搜索HKEY_LOCAL_MACHINE System CurrentControlSet Services Tcpip Parameters.

See also other related parameters in the above link. I don't know if the names of the config values changed in more recent versions of Windows but HKEY_LOCAL_MACHINE System CurrentControlSet Services Tcpip Parameters is something that I would search for if increasing the open files limit is not enough.

为进行比较,这是我增加的方式Linux中并发的Node/Express连接数.

这篇关于Node.js Express Windows Max连接设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆