0

I use the "rest-client" gem to create tests for my API calls.

However, I would like to get lower level details about the timing of the HTTP request. In particular, I am interested in knowing exactly how long the server processing takes, independent of the time needed to make a connection or transfer the returned data.

It is easy enough to get such details if you're using curl from the command line.

But how can I do it with the "rest-client" gem? (Or with another ruby gem?)

Jonah
  • 15,806
  • 22
  • 87
  • 161
  • Is this for degugging/optimizing, or is it an application that makes use of that information? – sawa Jul 14 '13 at 09:33
  • This is for debugging – Jonah Jul 14 '13 at 09:34
  • Then Opening the Google Chrome Developers Tools and looking into "Profiles" or "Timeline" may help. – sawa Jul 14 '13 at 09:35
  • @sawa, Thanks, but I want to be able to do it with ruby. I can get the information using curl, as described in OP, but it's not convenient or easy to automate – Jonah Jul 14 '13 at 09:36
  • The client doesn't get to find out how long the server actually took to produce the response, not unless the server explicitly says so. There is no standard mechanism for this either. All the client can measure is when things are done on its side of the network. Try looking in the server logs... – Donal Fellows Jul 14 '13 at 12:34
  • @DonalFellows, But curl reports this information. How is it able to do so? Fwiw I care about the time between when the connection is established and data starts coming back. – Jonah Jul 14 '13 at 12:39
  • Curl does not report that information, whatever you think it does. It _cannot_ know when the server actually starts processing. It _cannot_ know when it actually finishes. It can only see when the client starts sending content, finishes sending content, starts receiving content, and finishes receiving content. These can overlap. Network delays are included, and can only be crudely guessed at due to proxies and CDNs. – Donal Fellows Jul 14 '13 at 12:45
  • @DonalFellows, If you are interested, here is some low hanging fruit (I asked earler this morning) that it sounds like you are qualified to answer: http://stackoverflow.com/questions/17638026/calculating-server-processor-time-with-curl. Keep in mind I am looking only for a decent approximation of server processing time. – Jonah Jul 14 '13 at 12:54

0 Answers0