Jxadro
Jxadro

Reputation: 1637

Bluemix. Monitoring and Analytics. Response time not correct

I have a node.js application that I'm monitoring using "Monitoring and Analytics" service.

I'm using a jMeter (or SOAP UI) to do a load test against my node.js application. The average response time I'm getting with the load test tools is 900ms but in the Monitoring and Analytics graph it shows 111ms.

On the other hand the throughput is correct.(110tx/sec on jMeter, 6600tx/min bluemix)

Am I misunderstanding something in the bluemix graphs? Why this 800ms difference?


EDIT: The 800ms overhead could be caused because of my computer / tools / network but while I'm running the test with 100 concurrent threads in my local environment, in other location (network / place) one single invocation to the service takes also 900ms, if my environment is the cause in other location the response time should be a bit more of 111ms not 900ms so I think it is not related to my infrastructure.

Thank you.

Upvotes: 0

Views: 141

Answers (2)

Chris Bailey
Chris Bailey

Reputation: 292

The Monitoring and Analytics service measures the time it takes for the Node.js application to build the HTTP response from the point that the request is handled.

Here's a simple HelloWorld example annotated with the measurement points:

var http = require('http');
var port = (process.env.VCAP_APP_PORT || 3000);
var host = (process.env.VCAP_APP_HOST || 'localhost');

http.createServer(function handler(req, res) {
    // TIMER STARTS
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World');
    // TIMER ENDS
}).listen(port, host);

This means that two (potentially major) latencies are not measured:

  1. The network latency

    ie. the time taken for the network to send the request from browser to Node.js server, and for the response to be transmitted back.

  2. The HTTP request queue latency/depth

    ie. the time it takes from the Node.js receiving the HTTP request to the point that it can be handled. As Node.js has an event loop that runs on a single thread, only a single "blocking" action can be handled at a time. If the applications handling of the HTTP request is purely blocking as it is in the HelloWorld example (no asynchronous calls occur), then each HTTP request is handled in serial.

Its the second of these that's likely to be causing your delay - the HTTP requests are running in serial, so the Monitoring and Analytics service is telling you that it takes 111ms to build the response to the request, but there's an additional 800ms where the request is queued waiting to be run.

Upvotes: 2

DevAlien
DevAlien

Reputation: 2476

The difference is that you don't have the network latency from client to server and server to client. Bluemix will record just the latency when it gets the call and when the response goes out. While with jMeter you are recording when the response will leave your computer and then when the response will come back (downloading the data as well).

900 ms is A LOT, I'm guessing how much data you receive with every single call.

Upvotes: 0

Related Questions