Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to effectively implement sessions in GAE?

I was wondering about implementing my own sessions (more for an exercise than anything else) for a GAE app I'm working ... at first I was thinking of using the datastore to store the session data. However, every time something needs to be added to the session 'bucket', it would require saving to the datastore. Obviously that's bad since we want to minimize our writes. Then I thought about using memcache ... seemed like a good idea but then we're faced with issues of possible session corruption due to memcache being "evicted through memory pressure" by Google. So does that mean we are left with only the following options:

  1. Storing all session data in cookies
  2. Writing all session data to datastore and memcache, and then only reading from memcache

Anyone have any other ideas?

like image 728
fuentesjr Avatar asked Oct 24 '08 22:10

fuentesjr


2 Answers

UPDATE - 21 Mar 2011

At the time of this answer app-engine-patch is discontinued and gaeutilities offer worst features than gae-sessions.

  • GitHub gae-sessions
  • HowTo 10-steps tutorials
like image 168
Cesar Avatar answered Nov 18 '22 18:11

Cesar


I suggest checking out (and contributing to) these three implementations of appengine sessions before rolling out your own:

  • app-engine-patch
  • gaeutilities
  • gae-session

Your options look fine but choosing between them probably depends on the size of the session data in your application.

like image 35
Alexander Kojevnikov Avatar answered Nov 18 '22 19:11

Alexander Kojevnikov