Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

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

Nate Clark
Thursday, April 23, 2009

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.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

2 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?

    April 23, 2009 at 5:19 pm

  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.

    April 24, 2009 at 7:23 am

Add New Comment Cancel reply

Your email address will not be published.

Nate Clark

Nate Clark
San Francisco

Recent Posts

  • 09/25/12: It’s about something
  • revealing the ActionController callback filter chain
  • Standup 9/17/2009: silly Ruby tricks, unstub!, iPivotal => PTCruiser
Subscribe to Nate's Feed

Author Topics

agile (6)
rails (1)
rails3 (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >