While working on getting the Joomla CMS functioning on GAE, I've been 
learning a few things.

One item I did was setting up a GAE specific memcached driver for caching 
and session handling.  However, after doing so and digging a bit deeper, I 
realized that there are 2 different memcached implementations.

Method 1: Shared memcached..  You can't lock sessions when updating - and 
since it is shared, your cached items can be evicted from memcache due to 
unpredictable usage by everyone else sharing the cache[a reasonable 
expectation].  This makes it especially bad for session handling as you can 
"lose" a session fairly easily.

Method 2: Dedicated memcached.   Solves the eviction problem - but if you 
only need a small amount of cache space[under 50Mb] your going to have to 
overpay since the minimium space you can reserve is 1G - so you pay for a 
lot of wasted space.

The gs:// stream driver for Google Cloud Storage turns out to be an 
excellent option - you get file like access to the cached data - so you can 
lock and unlock the file.  You can configure buckets to expire objects. 
 Minimum time to live is 1 day, so it doesn't help with cache management 
for things that should expire in, say, an hour.  But what it does do is 
allow cache cleaning for a website that has a sudden large spike in 
traffic[and thus a large number of cache files are created] - and then 
traffic stops for a few days.  If you set your lifetime to 1 day, then you 
know that there is some sanity checking and cleaning of temporary files 
that will occur regardless of if the cached item is checked.  So you can 
eliminate the spending time on garbage collection, and only check 
expiration dates for items as they are retrieved to make sure they are not 
stale.

Plus the PHP stream driver will automatically cache any file read from 
google cloud storage into the GAE memcached system - and you can configure 
the TTL for that cache. The driver will automatically check memcached 
before trying to read a file from GS AND whenever a file is written to GS 
it automatically will delete it from memcached if it has been saved there.

So by using Google Storage you get the speed of Memcached AND the 
dependability of Google Storage.   

I think I've found my session handler. :-) 

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to