educative.io

Pre-generating the News Feed question

When user opens the app, the news feed will be refreshed with new photos. Let’s assume the server pre-generating the News Feed for the user. What if the user switches to other app and doesn’t return back for a long time? Will the server keep pre-generating the news feed for the user?

if yes, then it’s wasting recourses when user is not on this app.
if not, how can user get real time news photos in the feed so fast when opening the app.

Does anyone have any ideas? Thank you!

Maybe dont pre- generate the feed if the user has not been active for a while (more than 3 months?) to prevent wasting resources

When I read the article, I assumed every user will only have one pre generated news feed at any point in time. I thought the way it works is when the user fetch the news feed, the system will then generate the next news feed since the last timestamp from the previous news feed. That way I don’t think you’re wasting resources. There’s still a case where a user won’t open the app again in months but I think that use case is negligible.

As for providing real time news feed whenever the user opens the app, I think you’ll have to have a completely different implementation than pre-generation. I can’t think of a good solution that’s real real-time.

I think since they are keeping only 500 FeedItems at any given time in memory (and they calculated the capacity estimations based off of that.), that’s a constant amount of “wasted” space.

But yeah, if the user has not logged in for a long time, they could stop generating the newsfeed for that user temporarily. They seem to have mentioned this in their solution.

**Should we generate (and keep in memory) newsfeeds for all users?** There will be a lot of users that don’t log-in frequently. Here are a few things we can do to handle this; 1) a more straightforward approach could be, to use an LRU based cache that can remove users from memory that haven’t accessed their newsfeed for a long time 2) a smarter solution can figure out the login pattern of users to pre-generate their newsfeed, e.g., at what time of the day a user is active and which days of the week does a user access their newsfeed? etc.

I dont see it now, has this been removed?
I like Twitter approach of storing feeds for active users only.