Reputation: 48483
I wonder about the best approach for measuring the speed of loading pages of an app. I would like to see, how much time took the loading pages of the app because of improving SQL queries etc. and then would be good to display these measured values to the graph.
How do you solve this problematic? My idea is put on the start of the page and to its end timer and every value save to the database, but I am not sure if this is the good idea.
Upvotes: 0
Views: 262
Reputation: 9611
If you want to measure the speed of the page then you should be using Navigation Timing. In chrome, load the page, open your developer tools and type performance.timing
in your console. That'll give you DNS, connection time, server response time, and much more.
Note that setting a manual timer in your browser wont give you any of the above information since the timer will only be set when the browsers parses your javascript - and hence the reason for the Navigation Timing spec. Also worth mentioning that Google Analytics samples this data for you automatically! Here are some slides that cover Nav Timing, GA, and a number of other front-end optimization tools: http://www.igvita.com/slides/2012/html5devconf/
If you're specifically interested in SQL, then your server logs is where you ought to be looking (not in your browser).
Upvotes: 1
Reputation: 4245
I use very helpful gem QueryReviewer for this purpose. It can analyze every SQL query, give some useful information about it. And it displays this interactive summary directly on the page.
Upvotes: 1