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 badges1 Answer
Reset to default 4As 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条)