Question about HTTP request latency

I have a question from our Cloud-guy.

“A request made from an IMP agent to our EC2 based nodejs REST service always takes approximately 115ms to complete, even if the REST service does nothing but return 200:OK. Is this typical?”

This is observed after geographic latency was accounted for. The figures are pretty consistent (+/- 5%). Our agents are on the Dev servers, as far as I know. Is this an effect of the VM time-slicing? HTTP request broken up over many small TCP packets?
I can’t yet say whether this is holding up Node.js or not, but we are conscious of throughput requirements, and will be curious to see how this would scale up.

You didn’t specify which EC2 zone your server is in?

If, for example, I request http://www.google.com I see ~45ms for sendsync() to complete. If I hit something in us-west-1 I see more like 12ms.

Requests are not in small packets, are made by libcurl, and though are obviously affected by server load, mean latency is generally ~2ms or less from an event completion (eg an HTTP response) to when the agent code starts running again.

What are you trying to do with the requests? You can stream data back from your server to the imp over a single request (outbound streaming is however still on the roadmap).

North Virginia, is that us-east, I guess? Requests appear to be more fragmented than we expected. At this stage, we were just comparing simple requests (that did nothing, just got 200:OK in response) from the imp agents against ones that we generate ourselves.

Can you clarify a bit more about what “more fragmented” means? TCP fragmentation? Request arriving in multiple packets? etc. We use libcurl so it should be pretty “normal”.

Yes, I’ll pm you with wireshark captures for comparison.

Looks like libcurl is putting the headers and body into two separate packets, which is not very unusual & not likely a huge performance hit, but we’ll see if there’s an option we can tweak.

In the video I made of a webpage controlling an RGB light you can see the latency, there was an annoying lag between pressing the button and the light changing.

I just assumed it was because I am on dev and in the UK

Being in the UK will give you some lag, but generally this should be in the 100’s of ms range at the most?