Rails performance monitoring
SpeedUpRails is a development helper for a rails application.
It collects performance data in Rails application.
For longterm vizualization you can use a counterpart engine called speedup-dashboard.
But you can use 3rd party vizualization as well, Grafana with InfluxDB engine is a good example.
The easiest way to install speedup-rails is by using Ruby Gems. To install put in your Gemfile:
gem 'speedup-rails'
You can configure speedup-rails trough the environment files, or yml file in Rails.root/config/speedup-rails.yml
with format:
development:
disabled_collectors:
- bullet
In file you can disable collector like:
In development environment all you have to do is include a gem in your Gemfile.
But you can wish to choose an adapter for storing a request data.
Available adapters are:
Adapter can be chosen in config file:
Rails.application.configure do
config.speedup.adapter = :server, {url: 'http://path/to/server', api_key: '<your_key_generated_by_server>'}
end
There is implemented server side application as Engine, so best is to use it:
https://github.com/ezrondre/perfdashboard
In developement you can see the speedup toolbar at bottom of your page.
It is available for all your request ( even for redirected and ajax ones ) and shows information from all allowed collectors.
You can disable it by, or set some css styles - for now just an zindex, but there are expected more options.
config.speedup.show_bar = false
config.speedup.css[:zindex] = 10
Well that depends on what collectors you allow.
This is your options:
every option is in form of collector
Collectors are defined by a configuration ( in environment file or in application.rb)
Add Profiler collector:
Rails.application.configure do
# config.speedup.collectors << :rubyprof
config.speedup.collectors << {rubyprof: {profile_request: true} } #collector with options
end
default collecotors are :request, :queries, :partials ( + :bullet and :rubyprof in developement )
Everything you need to do is enable rubyprof collector ( default in developement )
and wrap profiled code in block:
Speedup.profile do
...
end
if you want to profile full request, just set
{ profile_request: true }
in rubyprof options
See MIT-LICENSE for license information.
Code is located at https://github.com/ezrondre/speedup-rails
Any contribution, or feedback will be appreciated.