Memcache storage failing across mongrels

We’ve been using memcached to store sessions across our mongrel
cluster but we’ve noticed that when apache switches us to a different
mongrel our session dies and we get logged out. Further, when I switch
mongrels manually (using different ports) the same thing happens. I’ve
been hunting around for the last couple of days on this but to no
avail so I thought I would ask the experts.

There are two versions, the version from err’s blog and an updated one
that seems like it’s more in line with memcache-client 1.3.0 options.
They perform exactly the same.

Also below is a sample dump from memcached -vv

Thanks in advance for any advice!

Sincerely,
Chuck V.

=====================

Here is my environment.rb:

Rails::Initializer.run do |config|
config.action_controller.session_store = :mem_cache_store if
RAILS_ENV = ‘production’
config.plugins = [“engines”,"*"]
end

memcache_options = {
:namespace => “nef_#{RAILS_ENV}”,
:readonly => false,
:multithread => true
}

CACHE = MemCache.new(‘localhost:11211’, memcache_options)

ActionController::Base.session_options[:expires] = 1800
ActionController::Base.session_options[:cache] = CACHE

— OR —

Rails::Initializer.run do |config|
config.action_controller.session_store = :mem_cache_store if
RAILS_ENV = ‘production’
config.plugins = [“engines”,"*"]
end

require ‘memcache’

memcache_options = {
:c_threshold => 10_000,
:compression => true,
:debug => false,
:namespace => “nef_#{RAILS_ENV}”,
:readonly => false,
:multithread => true
:urlencode => false
}

CACHE = MemCache.new memcache_options
CACHE.servers = ‘localhost:11211’

ActionController::Base.session_options[:expires] = 1800
ActionController::Base.session_options[:cache] = CACHE

=====================

<6 new client connection
<6 get nef_production:session:d9ac0790bc2de7fc10924ac10794afb1

6 sending key nef_production:session:d9ac0790bc2de7fc10924ac10794afb1
6 END
<6 set nef_production:session:d9ac0790bc2de7fc10924ac10794afb1 0 1800
456
6 STORED
<6 get nef_production:session:d9ac0790bc2de7fc10924ac10794afb1
6 sending key nef_production:session:d9ac0790bc2de7fc10924ac10794afb1
6 END
<6 set nef_production:session:d9ac0790bc2de7fc10924ac10794afb1 0 1800
658
6 STORED
<6 get nef_production:session:d9ac0790bc2de7fc10924ac10794afb1
6 sending key nef_production:session:d9ac0790bc2de7fc10924ac10794afb1
6 END
<6 set nef_production:session:d9ac0790bc2de7fc10924ac10794afb1 0 1800
658
6 STORED
<7 new client connection
<7 get nef_production:session:d9ac0790bc2de7fc10924ac10794afb1
7 sending key nef_production:session:d9ac0790bc2de7fc10924ac10794afb1
7 END
<7 set nef_production:session:d9ac0790bc2de7fc10924ac10794afb1 0 1800
456

Chuck, did you solved this?

dear sender,
i´m out of the office until may 29th.
your email will not be forwarded.
for urgent stuff please contact [email protected]
kind regards,
alexander

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs