Question

I've set up a Radiant instance using Memcached as the Radiant cache resource, however, it appears that cache hits aren't being logged to Radiant.

Here's an example of the cache implementation:

# file: :rails_root/config/environments/[RAILS_ENV].rb
require 'dalli'
$cache = Dalli::Client.new(["remotehost.com:11211", "127.0.0.1:11211"], :compress => true)
config.middleware.use ::Radiant::Cache, :metastore => $cache, :entitystore => $cache

When I toss load at the Radiant instance (via httperf) only the cache misses are registered in NewRelic.

::edit::

Some things that might also be worth noting:

  1. I'm using nginx and unicorn.
  2. I'm currently requiring newrelic in :rails_root/config.ru like so:

    begin
      require 'newrelic_rpm'
      NewRelic::Agent.after_fork(:force_reconnect => true)
    rescue LoadError
      # proceed without NewRelic
    end
    
  3. I'm using bundler, here's a sample of my Gemfile:

    source "http://my_gem_server"
    source :rubygems
    
    gem "radiant", "~> 1.1.0"
    gem 'unicorn'
    gem 'therubyracer', '~> 0.9'
    gem 'newrelic_rpm'
    gem 'rack-cache'
    gem 'dalli'
    gem "compass-rails", "~> 1.0.3"
    group :extensions do
      # radiant extensions
      gem "radiant-archive-extension",             "~> 1.0.7"
      gem "radiant-clipped-extension",             "~> 1.1.0"
      gem "radiant-debug-extension",               "~> 1.0.2"
      gem "radiant-exporter-extension",            "~> 1.1.0"
      gem "radiant-markdown_filter-extension",     "~> 1.0.2"
      gem "radiant-snippets-extension",            "~> 1.1.0"
      gem "radiant-site_templates-extension",      "~> 1.0.4"
      gem "radiant-smarty_pants_filter-extension", "~> 1.0.2"
      gem "radiant-textile_filter-extension",      "~> 1.0.4"
    
      # additional extensions
      gem "radiant-index_page-extension",          "~> 1.0.1"
      gem "radiant-vapor-extension",               "~> 2.1.4"
      gem "radiant-reorder_children-extension",    "~> 1.0.6"
      gem "radiant-layouts-extension",             "~> 1.1.3"
      gem "radiant-sibling_tags-extension",        "~> 0.2.1"
      gem "radiant-if_param_tags-extension",       "~> 1.0.1"
      gem "radiant-cache_buster-extension",        "~> 0.0.1"
    
      # forked extensions
      gem "radiant-sheets-extension",              "1.1.0my1"
    end
    
  4. Something I've tried:
    • Moving newrelic's require code to both the top and bottom of config.ru.
    • Moving gem "newrelic_rpm" to the top and bottom of my Gemfile (bottom per: https://newrelic.com/docs/ruby/does-new-relic-work-with-the-bundler-gem)
    • Moving newrelic's require code to the bottom of my :rails_root/config/enivornments/[RAILS_ENV].rb
    • Moving newrelic's require code in to :rails_env/config/boot.rb and :rails_env/config/environment.rb -- both top and bottom.
    • Requiring newrelic_rpm explicitly in the Gemfile with gem "newrelic_rpm", :require => 'newrelic_rpm'

::/edit::

Anyone have any ideas?

Thanks!

Was it helpful?

Solution

After working with NewRelics support staff, they let me to this post: http://newrelic.github.com/rpm/NewRelic/Agent/Instrumentation/Rack.html.

I then deconstructed this method a bit and came up with the following solution:

https://gist.github.com/4076773

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top