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

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

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).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744795681a4594190.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信