Skip navigation

Trying to figure out how to solve the “eventual consistency” problem with Amazon’s SimpleDB.  Putting an attribute in SimpleDB and immediately reading it can bring back old/stale data and might not reflect the attribute we just “put”. Good reading:

A layer of memcached servers can solve the issue. Here’s the strategy to use for the memcache layer:

  1. readers and writers read from memcache first to determine if something in cache
  2. if reader and nothing in cache (becomes a memcache writer) or if writer, lock the item for writing using add() function (wait until successful add)
  3. once you have lock, get or write from db and write to memcache, then remove the lock

This strategy should insure only one writer at a time to memcache.  The memcache data can then be reliably used by writers.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: