Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
Standup 4/23/2009: helper methods in view tests, mecached client

Interesting Things

  • memcache-client is broken in the sense that if it fails to connect to your memcached server, it will automatically try a new server. It does this 20 times. Not what one would expect. You can turn off this weird behavior by setting :failover => false

Ask For Help

  • When writing view specs, is there a better way to include your helpers if all helpers are not automatically included in ApplicationController? Some suggestions from the crowd: mock the helpers (test helpers separately), or reopen the template and define helpers there directly.

Comments
  1. Mike Perham says:

    What would you expect it to do if a memcached server goes down? Having multiple memcached servers with failover provides redundancy in case one fails. If you have two memcached servers, do you want the failure of one to cause 50% of your traffic to hit the DB?

  2. Joseph Palermo says:

    Mike

    Any keys that hash to a failed server should be treated as cache misses as the default behavior.

    The most common pattern around the office If your site relies upon memcached to stay up is to have warm standby servers monitoring the memcached servers and plugging the hole if one fails.

    The problem with failover to a different memcached server in the rotation is that in a high volume site that really needs memcached you are setting yourself up for a stale read scenario.

    The worst case scenario is a network split where some of your app servers think a memcached server is down and some think it is up, so you are getting a different version of the data depending on the app server you hit since there are two different copies living on two different memcached servers.

    There are also many situations where a memcached server going up and down repeatedly can lead to stale data being read from the failover memcached server depending on if the primary is currently up or not.

    Failover is not a big deal when you are only using memcached to store non-critical computed data where it doesn’t matter if you get a stale read sometimes. But it’s scary as a default behavior when users are not made aware of the potential repercussions.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *