Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

memcached going down #301

Closed
tkellen opened this Issue · 2 comments

3 participants

@tkellen

If memcached dies, what is the recommended method for dealing with this using Dalli? At the moment, I'm calling it directly on a basic Sinatra site.

My first thought was to make a simple class that wraps get/set/delete calls to the client in a begin/rescue block so they don't throw an exception and bring down the site. Is there a better way?

@shtoma

Hi. I'm in same situation.
After I killed the memcached process,
my app outputs these logs.

Cache read: https://{mysite}/assets/application-common.css?
Dalli::Server#connect {memcached-server}:11211
{memcached-server}:11211 failed (count: 11)
{memcached-server}:11211 is still down (for 498.355 seconds now)
DalliError: No server available
Started GET "/assets/application-common.css" for XXX.YY.Z.ZZZ at 2013-01-22 13:58:33 +0900
Served asset /application-common.css - 200 OK (0ms)
Cache write: ed003cd3b1a1be5cebcc05385c656fa8b6d2e3cd
down_retry_delay not reached for {memcached-server}:11211 (0.998 seconds left)
DalliError: No server available

telling DalliError is ok, but the exact application-common.css is empty file...

I wish no cache using if server is down, and want to know how to set the config.

Someone has ideal way?

my environments/{env}.rb

config.perform_caching = true
config.cache_classes = true

# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = true

config.cache_store = :dalli_store, '{memcached-server}',
{ :namespace => Rails.application.class.parent_name, :expires_in => 10.minutes, :compress => true }

@mperham
Owner

You can use :raise_errors => false to ignore memcached server failures in Rails.

config.cache_store = :dalli_store, "host-a", "host-b", { :raise_errors => false }

@mperham mperham closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.