最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - RequestError: Error: connect ECONNRESET 127.0.0.1:8443 - Stack Overflow

programmeradmin2浏览0评论

I'm querying 127.0.0.1:8443 via request-promise in NodeJS with 10K+ requests and are hitting:

{ RequestError: Error: connect ECONNRESET 127.0.0.1:8443

and/or

{ RequestError: Error: read ECONNRESET

If I lower my number of requests to say 10-100 there's no error.

Is this my NodeJS-client who are making the requests which cannot keep up, or is it the endpoint I'm trying to requests which cannot keep up?

I have control over both ends, and are not getting any error from the server I'm requesting.

I'm querying 127.0.0.1:8443 via request-promise in NodeJS with 10K+ requests and are hitting:

{ RequestError: Error: connect ECONNRESET 127.0.0.1:8443

and/or

{ RequestError: Error: read ECONNRESET

If I lower my number of requests to say 10-100 there's no error.

Is this my NodeJS-client who are making the requests which cannot keep up, or is it the endpoint I'm trying to requests which cannot keep up?

I have control over both ends, and are not getting any error from the server I'm requesting.

Share Improve this question edited Jan 27, 2017 at 9:59 Michael Nielsen asked Jan 27, 2017 at 9:44 Michael NielsenMichael Nielsen 1,2423 gold badges23 silver badges39 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

As per Node.js documentation:

ECONNRESET (Connection reset by peer): A connection was forcibly closed by a peer. This normally results from a loss of the connection on the remote socket due to a timeout or reboot. Commonly encountered via the http and net modules.

Since a large number of requests are hitting the server, it is getting overloaded (busy servicing previous requests before it can handle any new request).

Possible solutions:

  • Check/modify server timeout using server.timeout = 0. This is not a remended solution for production. However, it can help you in development/testing.

  • You can increase the maximum number of allowed connections using server.maxConnections but this too is not a remended solution for production. However, it will allow you to verify whether the server hardware capacity needs to be upgraded or the network bandwidth needs upgrade. If your server is in a good datacenter, usually it is the hardware capacity that needs to be upgraded (see next two solution).

  • If you are using a cloud server, increase the number of cores so that requests can be services faster.

  • Consider load sharing by having more than one instance of the server (behind a load balancer).

发布评论

评论列表(0)

  1. 暂无评论