Google App Engine - How to Implement a Social Network Activity Stream

I want some ideas of best practice to implement an activity flow for a social network building an app engine (PYTHON)

First, I want to keep a log of all the actions of each user, so we have a history. that is, someone became a friend, added a picture, changed their address, etc. This way we have user history available if we need it. Also means that we can delete friendly connections, change user data, but have a historical log.

I also want the user activity streams to be friends. it only needs to save recent X activities - that is, in a script that messages are sent to friends when an activity occurs.

Its a fairly straight forward projection of a history journal - that is: when, what, where. The complication is how we notify the user's friends about our activities.

In our application, friendships are not mutual, i.e. they are based on the following Twitter model. Some accounts may have thousands of followers.

What is the best approach to simulate this.

  • using a table with many for many and doing an expensive query -
  • using a feed class that issued a copy of the activity to all subscribers - perhaps in mcache? Since there may be thousands of messages to fire, I would suggest using a cron job.

Any thoughts help ideas on this

thanks

+2


a source to share


2 answers


There's a great talk by Brett Slatkin called Building Scalable Complex Applications in App Engine from last year's Google I / O, which, for example, is a Twitter-like application where user updates are pushed to their followers. Basically exactly what you are trying to do.



I highly recommend the video for anyone writing an App Engine application, it's really helpful.

+4


a source


  • Don't connect. They are too expensive, you can burn your quota quickly.
  • You can use a task queue , it's a bit like a cron job (i.e. stuff happens outside of the original request), but you can start them as you see fit. memcache would be nice if you were okay with losing activity when the cache turns red ...


0


a source







All Articles