I am using Node 0.12.2 with Express 4.13.3 as the frontend for a RESTful layer. Calling the API's from cURL/Postman takes ~9ms. However, using Request 2.60.0 to make the call from Node, it takes ~60ms. These are HTTPS calls. Removing HTTPS and using just HTTP brings Node down to ~7ms. Both the curl/Postman calls and the Node.js calls are happening on the same machine in the same environment under no load. I cannot seem to find what's causing Node to be so much slower than everything else. Any help would be greatly appreciated.
Asked
Active
Viewed 831 times
1
-
Try the option `{strictSSL: false}` which will disable CA verification. There's an obvious removal of security here to get more speed, so be advised. – Peter Lyons Sep 11 '15 at 23:20
-
Show us your node.js code please? And, have you examined a network trace with something like WireShark to see what that tells you? – jfriend00 Sep 11 '15 at 23:26
-
Here's a simple test harness which displays the same behavior https://gist.github.com/anonymous/09b2149404740675f1e2 – Jeff Sep 11 '15 at 23:32
-
Setting `{strictSSL: false}` only reduced response time by a couple of milliseconds. Still way off what I should be getting based on cURL/Postman – Jeff Sep 11 '15 at 23:38
-
Following up on this, it appears that `require('request')` is to blame. Removing request and using `require('https')` directly causes response times to drop from ~60ms to ~15ms – Jeff Sep 14 '15 at 22:38
1 Answers
1
Updating to Request 2.61.0 fixed the issue. Looks like there was an issue with their agent pool.

Jeff
- 159
- 10