Skip navigation

General requirements for ColorJacket.com

  • Store jacket file structure in S3 and metadata in SimpleDB fronted by memcached
  • Register jacket S3 bucket for use in CloudFront (for speed for our users)
  • Auto cluster EC2 instances will provide application to users
  • javascript based plugins for all browsers we support talk to backend cluster
  • php backend to act as web service answering calls from javascript frontend

More details

Create jackets bucket in S3 and store by jacket id, i.e., http://s3.amazonaws.com/colorjacket.com/jackets/public/0000000001

Use a hierarchy within the S3 jackets bucket for jacket assets:

http://s3.amazonaws.com/colorjacket.com/jackets/public/0000000001/backgrounds_body

http://s3.amazonaws.com/colorjacket.com/jackets/public/0000000001/thumbnails_small

http://s3.amazonaws.com/colorjacket.com/jackets/public/0000000001/screenshots_small

http://s3.amazonaws.com/colorjacket.com/jackets/public/0000000001/screenshots_large

http://s3.amazonaws.com/colorjacket.com/jackets/public/0000000001/css_current

http://s3.amazonaws.com/colorjacket.com/jackets/public/0000000001/css_00001

Create New Jacket (theme):

  1. user uploads a new picture
  2. system generates a new facebook theme (css) from the given picture
  3. user can tweak the following generated parameters; palette color, background attributes
  4. user can also tweak the css directly
  5. user saves final jacket (public or private)

Create New Jacket from existing:

  1. user chooses jacket to tweak
  2. goto step 3 of “Create New Jacket” above

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.