rlib rlib - 4 months ago 8
Linux Question

Travelling time of data through TCP/IP stack (Linux)

I want to know how much time occurs from the moment I call

res.send("Hello,World")


in my NodeJS application till the moment IP package leaves NIC card.
Is there a way to do this?

Why do I want to know that?

I have a server on CentOS6 serving 400 req/s. My partner who generates the requests measures my response time. Recently the request rate has increased to 800 req/s and the partner detected increase in my response time. The time from the moment my app gets request till it issues
res.send()
has not changed. Therefore, the hypothesis is that Linux TCP/IP stack has slowed. I want to check this hypothesis by actually observing the time needed by TCP/IP stack to process my response.

Answer

After res.send() has been the called the package has left the NIC. What you are interested in is the time send() takes.