How to implement a personalized stream of events?

I’m going to work on an NGO inspirational site, and I’m going to implement some kind of Facebook-esque stream of events with events like “Michael recommended apple pie”, “John commented on a chocolate cake”, “Caramel fudge was posted 8 hours ago Alice, "etc.

The fact is that these events are based on interests, so someone is only interested in caramel and cherry, and then you should not see apple pies or chocolate cakes. There are many permutations for this, and generating a personalized stream of user events on the fly means several fairly expensive database queries.

So, I was thinking about pre-creating a relationship between the receiving user and the hosted event (possibly a simple SQL JOIN table), doing some kind of background processing whenever an action event occurs.

The work needed to weigh the preferences of hundreds of users regarding the event must be substantial, so this cannot be done as part of the POST request that starts the work, so I have to do most of the work in another process. Im currently looking at Gearman for this task, but Im very open to suggestions.

I am not looking for someone to do my work for me, but if someone has any previous experience in creating these kinds of things, I would like to hear your thoughts.

+5
source share
5 answers

I had some experience creating a news feed on a social network site and yes, requests can occur very quickly very quickly when you have several types of events and several levels of interest (either privacy settings or user permissions).

Assuming that events are viewed more often than they are generated, it makes sense to do some denormalization and calculate potential event viewers when this happens, and not every time someone asks for a news feed.

, ( ) ( , , ). , .

Gearman, , , , , .

, beanstalkd PHP.

+2

, ( ), - ,

SELECT events.* FROM events, event_tags, user_tags
     WHERE event_tags.event_id = events.id 
         AND event_tags.tag_id = user_tags.tag_id
         AND  user_tags.user_id = <$user_id>

, ,

+1

, . , , . - , . , , , .

+1

Facebook , , , , .

+1

Activity? :

... monitors what people are doing on your site, and provides mini-channels of these actions in blocks, in a specialized table and via RSS. The module is expandable so that any other module can integrate with it. Received messages are configured through the admin interface and are context sensitive.

I will be interested to know what you came up with because you need to do something similar in the near future.

+1
source

All Articles