I have an node js express app. One of the endpoints in my app serves as a proxy to an external web service. When running a stress test with 2000 users per second directly against the external service, the response time was only 50ms. However, when running the same test against my endpoint, the response time was about 3 seconds. This is strange because when testing my app against an empty endpoint that simply returns 200 right away, the average response time is about 150ms.
Basically I'm just using the request module, and all I do is to forward the requests to the external service. I tried playing with the maxSockets parameter of the http module, but without results. Here is my setting:
var http = require('http');
http.globalAgent.maxSockets = 1000;
var request = require('request');
var options = {
uri: params.SERVICE_URL,
method: 'POST',
headers: { 'content-type' : 'application/json' },
json: bodyOfRequest
};
request(options, function (error, response, body) {
// return response to client
}
via Mister_L
No comments:
Post a Comment