title: How would you design an AppEngine datastore for a social site like Twitter?
body: <p>I'm wondering what would be the best way to design a social application where members make activities and follow other member's activities using Google AppEngine.</p>
  
  <p>To be more specific lets assume we have these entities:</p>
  
  <ul>
  <li><strong>Users</strong> who have friends</li>
  <li><strong>Activities</strong> which represent actions made by users (lets say each has a string message and a ReferenceProperty to its owner user, or it can use parent association via appengine's key)</li>
  </ul>
  
  <p>The hard part is following your friend's activities, which means aggregating the latest activities from all your friends.
  Normally, that would be a join between the Activities table and your friends list but thats not a viable design on appengine as there are no join simulating it will require firing up N queries (where N is number of friends) and then merging in memory - very expensive and will probably exceed request deadline...)</p>
  
  <p>I'm currently thinking of implementing this using inbox queues where creation of a new Activity will fire a background process that will put the new activity's key in the "inbox" of every following user:</p>
  
  <ul>
  <li>Getting "All the users who follow X" is a possible appengine query</li>
  <li>Not a very expensive batch input into a new "Inbox" entity that basically stores (User, Activity Key) tuples.</li>
  </ul>
  
  <p>I'll be happy to heard thought on this design or alternative suggestions etc.</p>