Q:

RequestError: Error: connect ECONNRESET 127.0.0.1:8443

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.

A:

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

