4

Question also asked over on miniprofiler forums.

Saw a great railscast today about rack-mini-profiler gem, which is EXACTLY what I need right now to track down some performance issues. Works great in dev, but I really need it in production where the full load of data is.

I'm not very experienced with RACK, or much more than writing my rails app and making it go. I put in miniprofiler today in our rails project that I need to do some performance fixes on and then put it up into production. I also followed the instructions here http://samsaffron.com/archive/2012/07/12/miniprofiler-ruby-edition about putting in a before filter, and only turn on profiling if the user is in the appropriate admin groups. Traced thru the code and it works fine in dev.

In production however, its not turning on. I don't know if thats because:

  1. I need to flip a magic bit somewhere else to tell it to turn on in production
  2. I need to do something weird in Heroku to get it to play nice, or
  3. There's no hope.

Anyone use this gem in heroku yet and have any feedback? In the meantime, I'm going to point dev system at production, but that adds additional latency too.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
Dave Sanders
  • 3,135
  • 4
  • 33
  • 43
  • Dave did you resolve this issue? Any pointers? I will be attempting to do the same in the next day or so. Are you using Cedar or Bamboo? – Mark Ellul Oct 03 '12 at 10:24
  • You know I thought I had, but then I checked it again today and its not running. I think what I ended up doing was just running it locally pointing at my production DB. I'm on Cedar, but on my next production push I'm going to look into it again in more detail. – Dave Sanders Oct 03 '12 at 14:26
  • Off topic, but what does MiniProfiler actually use storage for? It seems like it would work just fine without storage, displaying the info for the life of the request. Is it only used when you click the 'share' button? Thanks! – Brian Armstrong Nov 04 '12 at 23:09

1 Answers1

2

I used Redis2Go addon to store data, and a slightly customized Gem for the Redis connections because of the limit for the free version of the addon.

The Repo is available here... https://github.com/mark-ellul/MiniProfiler

I added an initializer with the code below...

uri = URI.parse(ENV["REDISTOGO_URL"])
Rack::MiniProfiler.config.storage_options = { :host => uri.host, :port => uri.port,    :password => uri.password }
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::RedisStore
Rack::MiniProfiler.config.pre_authorize_cb =  lambda { |env|
    true
  }
Mark Ellul
  • 1,906
  • 3
  • 26
  • 37