Wednesday, July 30, 2008

Stop the dog-pile: freshen your cache

It's no question that RSSmeme has been gaining in popularity. With increased visitors comes increased load and with that comes increased wait times. RSSmeme caches the data that comes out of database for several minutes to keep things snappy but let's look at what happens when that cache gets old. Under the old, simplistic system:
  1. The home page cache gets old and stale.
  2. 50 visitors request the home page at the same exact time.
  3. The server gets clogged running the exact same query for all 50 visitors.
  4. Meanwhile more visitors hit other pages and nobody ever gets results because the server is overloaded; the dog-pile effect.
Under the new, system (using MintCache):
  1. The home page cache gets old.
  2. 50 visitors request the home page at the same exact time.
  3. The 1st visitor triggers a database query to get fresh data. The other 49 get the now slightly stale data. Only 1 call has been made to the database.
  4. The cache is updated with the fresh data that was sent to the 1st visitor and everyone is happy.
It's slightly more complicated but the results are already promising. Hopefully this keeps RSSmeme speedy.

2 comments:

lee woo said...

A stale article, if you dip it in a good, warm, sunny smile, will go off better than a fresh one that you've scowled upon. see the link below for more info.


#stale
www.ufgop.org

Vicky Joe said...


Life is a battle, if you don't know how to defend yourself then you'll end up being a loser. So, better take any challenges as your stepping stone to become a better person. Have fun, explore and make a lot of memories.

n8fan.net

www.n8fan.net