As far as I understand, Rails uses a middleware by default that will send the total time spent on a request in the Rails side in the X-Runtime HTTP header.

But it doesn't seem to be reliable in the sense that when I perform a request against http://localhost:3000/ (development environment, tested with both Puma and Webrick), I get 10ms of latency when serving some CSS assets but 109ms of latency for the index page. When I look at the header for the same request, I get "X-Runtime: 0.034849".

Here's how it reports the timing in the server logs:

Completed 200 OK in 22ms (Views: 1.4ms | Sequel: 13.2ms)
  Rendered search/_fields_finder.html.erb (0.0ms)
  Rendered search/_left_pane.html.erb (0.7ms)
  Rendered search/_index.html.erb (8.9ms)
  Rendered transactions/_list.html.erb (0.0ms)
  Rendered search/_saved_searches_dialogs.html.erb (0.2ms)
  Rendered search/_saved.html.erb (0.5ms)
  Rendered main/_change_log.html.erb (0.1ms)
  Rendered main/_glossary.html.erb (0.0ms)
  Rendered themes/default/_footer.html.erb (0.1ms)
  Rendered main/index.html.erb within layouts/main (70.5ms)

This happens because I'm using "render stream: true" in that action, but I'd expect the latency to be reduced when looking at the Chrome reported timing, but it doesn't matter if I render with "stream: true" or not, the latency reported by Chrome is always about 100ms.

Am I missing something?

Thanks in advance,
Rodrigo.

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to