6 ms·
Rack-Mini-profiler – The Secret Weapon of Ruby and Rails Speed
- sergiotapia 11y agoAnother tool that helped us out tremendously was http://stackshare.io/skylight http://stackshare.io/skylight. It allowed us to quickly determine what pages were slowest and why, but also what pages were being hit the most by users. Sorting by 'agony' means: "This page is a combination of being hit the most, and the slowest. Take care of it pronto." Amazingly, we started knocking out 'agony' problem areas, and our site is super quick now with minimal effort. Here's an example of what their dashboard looks like: http://i.imgur.com/b4zhh6Q.png http://i.imgur.com/b4zhh6Q.png
- bdcravens 11y agoI've tried out Skylight, but if you already have New Relic, didn't see anything new.
- sergiotapia 11y agoNewRelic's UX is ABYSMAL. It has not once given us useful insight into anything.
- spo81rty 11y agoAre there tools like this for other languages? For asp.net there is Glimpse and the Mini profiler. What about Java, php, node, python?
- sergiotapia 11y agoFor Meteor (Javascript) there's Kadira. http://stackshare.io/kadira http://stackshare.io/kadira
- mediumdeviation 11y agoFor PHP there is PHP Debug Bar - http://phpdebugbar.com/ http://phpdebugbar.com/, although if you're using a framework you'd want to find the fork with the bindings. I'm using the one for Laravel and it's pretty good https://github.com/barryvdh/laravel-debugbar https://github.com/barryvdh/laravel-debugbar
- troels 11y agoThere's also xdebug, which can give a lot of detailed information. And then there's New Relic for PHP.
- nateberkopec 11y agoThere are similar MiniProfilers for Go, Node, and Dotnet: https://github.com/MiniProfiler https://github.com/MiniProfiler
- orf 11y ago> To see a full list of rack-mini-profiler's features and info on how to trigger them, add ?pp=help to the end of any URL Wait... in production? Anyone can do this?
- matthuggins 11y agoMy guess is that this blurb is relevant: > rack-mini-profiler runs in the development environment by default in Rails apps. We're going to enable it in production, and hide it behind a URL parameter. You can also do things like make it visible only to admin users, etc.
- nateberkopec 11y agoNo. RMP is disabled by default in production and must be enabled manually with `Rack::MiniProfiler.authorize_request` - so you can set it up behind a URL parameter, or something more secure like your already-built admin system or whatever.
- rubiquity 11y agoGood post but please, please, please don't enable this in productiont. What an extremely wonderful way to DDoS any Rails app (as if it weren't easy enough already). If you need production like characteristics for accuracy of profiling then set up another environment that is production-like (Rails settings, replicated database, infrastructure etc.) and run it there.
- nateberkopec 11y agoYou can put `rack-mini-profiler` behind authentication. It is not enabled by default in production. I believe I mentioned this in the article, if not, it's in the README.
- rubiquity 11y agoI would try and word it more carefully. The phrase "in production" has serious meaning. I think that's what startled myself (and it seems like some others, too).
- madebysquares 11y agoAlthough your take away may have been that everyone should enable it in production. I think every developer should use common sense and practical knowledge when implementing a feature in their application. If you want to use it you should know that having this available for all users is not a great idea, and use it accordingly.
- rubiquity 11y agoYou would be surprised by the lack of common sense in the software community. Maybe even more so in Ruby/Rails. As an example, there are a lot of people running WEBrick in production.
- otterley 11y agoI agree with rubiquity - the article as written strongly suggests that users enable it in production. I'd amend it to be far clearer about what you mean. Directly from the second paragraph: > The best part - rack-mini-profiler is designed to be run in production. Yeah! Then later: > rack-mini-profiler is designed to be used in production.
- matthuggins 11y ago> If you're forcing SSL in production, you're going to want to turn that off for now. Great article, but there's no further mention about SSL. Specifically, why should I turn it off in the first place for this gem, and when/how can I turn it back on? Is there some special step(s) needed to do so, and what are they?
- btucker 11y agoIt's because the article takes you through running your app in production environment locally on your machine. To do that with ssl you'd need to get that setup locally as well, so I think the author just wanted to avoid dealing with that.
- nateberkopec 11y agoCorrect - that's exactly what I meant. Don't turn your SSL off on your production server just to run this gem - that'd be silly!
- rubiquity 11y ago> production environment locally on your machine Oxymoron!
- deleted 11y ago[deleted]
- yoran 11y agoThe development mode of New Relic (https://docs.newrelic.com/docs/agents/ruby-agent/developer-mode/developer-mode https://docs.newrelic.com/docs/agents/ruby-agent/developer-m...) is another good tool to find out about response times of your controller actions and the number of SQL queries. I'm pretty sure you can use it even if you're not on a paying plan for New Relic. We switched to this after we weren't been able to get rack-mini-profiler to work in a Rails app for a single-page app as the Rails app only returns JSON and doesn't render templates.
- programminggeek 11y agoThe secret to rails speed is not using rails at all.
- gregmolnar 11y agoYeah, better to use assembly and spend a week to implement trivial features :)
- hiphopyo 11y agoHasn't Peek (https://github.com/peek/peek https://github.com/peek/peek) sorta replaced Rack-Mini-Profiler?
- ebola1717 11y agoWhat's better about Peek?
- deleted 11y ago[deleted]
- sams99 11y agoThanks heaps Nate for the writeup! Some other resources on rack-mini-profiler are: https://samsaffron.com/archive/2013/03/19/flame-graphs-in-ruby-miniprofiler https://samsaffron.com/archive/2013/03/19/flame-graphs-in-ru... https://samsaffron.com/archive/2012/07/12/miniprofiler-ruby-edition https://samsaffron.com/archive/2012/07/12/miniprofiler-ruby-... Some history: https://samsaffron.com/archive/2011/06/09/+Profiling+your+website+like+a+true+Ninja https://samsaffron.com/archive/2011/06/09/+Profiling+your+we... My talk, measuring Ruby https://www.youtube.com/watch?v=LWyEWUD-ztQ https://www.youtube.com/watch?v=LWyEWUD-ztQ And Off the Rails https://www.youtube.com/watch?v=aP5NNkzb4og https://www.youtube.com/watch?v=aP5NNkzb4og
- spo81rty 11y agoI've never used it but there is also something called Rails Panel someone might find useful: https://github.com/dejan/rails_panel https://github.com/dejan/rails_panel