Does mongrel work with memcached?

Hello,

Has anyone gotten memcached to work with a mongrel cluster before? I
see
numerous posts on the internet of people who can’t get this to work, and
no
one saying it does.

Do these two technologies work together?

(Note: I say mongrel cluster. I know memcached works with a single
mongrel
instance).

-Iain

View this message in context:
http://www.nabble.com/does-mongrel-work-with-memcached--tf4297581.html#a12232426
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

Interesting… are you using memcache-client or Ruby-MemCache to make
your
bridge?

-Iain

Keith D.-3 wrote:

mongrel cluster and enabled memcached sessions in my environment.rb.

numerous posts on the internet of people who can’t get this to work, and


View this message in context:
http://www.nabble.com/does-mongrel-work-with-memcached--tf4297581.html#a12233843
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

Hurm, that suggests its a configuration issue. Could I take a look at
the
memcache lines you added for environment.rb please?

I’m using the “vanilla” ones posted on many blogs. Tried with both
clients
to no avail. I’m currently reading through the verbose debug from
Ruby-MemCache in the hope of spotting something…

-Iain

Keith D.-3 wrote:

On 8/20/07, innr [email protected] wrote:

Keith D.-3 wrote:

mongrel cluster and enabled memcached sessions in my environment.rb.

numerous posts on the internet of people who can’t get this to work,
-Iain


View this message in context:
http://www.nabble.com/does-mongrel-work-with-memcached--tf4297581.html#a12234130
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

OK, I did some debugging of Rails, and I think the answer is to do with
the
way Rails uses sessions. The mem_cache session store is actually
serialised
outside of the Rails framework, which means that it cannot instantiate
ActiveRecord objects upon load. This is different to the file_session
storage which is part of Rails.

This means that if you store ActiveRecord objects in your session, there
is
a good chance your application will not work with memcached. I’m
guessing
you opt for the more traditional route and only store IDs in the
session.

Different options at this point are to add additional extensions to the
CGI:Session object (serialising everything as a string upon save and
load)
so that mem_cache_session will work, changing the application to use
object
IDs rather than objects in the session, or going back to file based
sessions
and adding some kind of mutex so they will work with mongrel clusters.

Thanks for all your help,
-Iain

Keith D.-3 wrote:

On 8/20/07, innr [email protected] wrote:

Ruby-MemCache in the hope of spotting something…

mac, works on

bridge?
didn’t

On 8/20/07, innr [email protected] wrote:

no


View this message in context:
http://www.nabble.com/does-mongrel-work-with-memcached--tf4297581.html#a12250769
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

I am using memcache-client.

Also, I am running the production boxes on linux but developing on a
mac, works on
both.

Keith

The only line I’ve added is to the Rails::Initializer.run block and it
looks like
this:

config.action_controller.session_store = :mem_cache_store

Keith

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