Node.js maxing out at 1000 concurrent connections

前端 未结 2 802
滥情空心
滥情空心 2020-12-04 08:48

We\'re benchmarking node performance using a simple Hello World node server on AWS (EC2).

No matter what size instance we use Node always appears to max out at 1000

2条回答
  •  执笔经年
    2020-12-04 09:22

    Use the posix module to raise the limit on the number of file descriptors your process can use.

    Install posix

    npm install posix
    

    Then in your code that runs when you launch your app...

    var posix = require('posix');
    
    // raise maximum number of open file descriptors to 10k,
    // hard limit is left unchanged
    posix.setrlimit('nofile', { soft: 10000 });
    

提交回复
热议问题