Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9087639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:44:29+00:00 2026-06-16T21:44:29+00:00

I am in the process of creating a simple activity stream for my app.

  • 0

I am in the process of creating a simple activity stream for my app.

The current technology layer and logic is as follows:

** All data relating to an activity is stored in MYSQL and an array of all activity id’s are kept in Redis for every user.**

  1. User performs action and activity is directly stored in an ‘activities’ table in MYSQL and a unique ‘activity_id’ is returned.
  2. An array of this user’s ‘followers’ is retrieved from the database and for each follower I push this new activity_id into their list in Redis.

When a user views their stream I retrieve the array of activity id’s from redis based on their userid. I then perform a simple MYSQL WHERE IN($ids) query to get the actual activity data for all these activity id’s.

This kind of setup should I believe be quite scaleable as the queries will always be very simple IN queries. However it presents several problems.

  1. Removing a Follower – If a user stops following someone we need to remove all activity_id’s that correspond with that user from their Redis list. This requires looping through all ID’s in the Redis list and removing the ones that correspond to the removed user. This strikes me as quite unelegant, is there a better way of managing this?
  2. 'archiving' – I would like to keep the Redis lists to a length of
    say 1000 activity_id’s as a maximum as well as frequently prune old data from the MYSQL activities table to prevent it from growing to an unmanageable size. Obviously this can be achieved
    by removing old id’s from the users stream list when we add a new
    one. However, I am unsure how to go about archiving this data so
    that users can view very old activity data should they choose to.
    What would be the best way to do this? Or am I simply better off
    enforcing this limit completely and preventing users from viewing very old activity data?

To summarise: what I would really like to know is if my current setup/logic is a good/bad idea. Do I need a total rethink? If so what are your recommended models? If you feel all is okay, how should I go about addressing the two issues above? I realise this question is quite broad and all answers will be opinion based, but that is exactly what I am looking for. Well formed opinions.

Many thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:44:30+00:00Added an answer on June 16, 2026 at 9:44 pm

    1 doesn’t seem so difficult to perform (no looping):

    delete Redis from Redis
     join activities on Redis.activity_id = activities.id
                    and activities.user_id = 2 
                    and Redis.user_id = 1
    ;
    

    2 I’m not really sure about archiving. You could create archive tables every period and move old activities from the main table to an archive table periodically. Seems like a single properly normalized activity table ought to be able to get pretty big though. (make sure any “large” activity stores the activity data in a separate table, the main activity table should be “narrow” since it’s expected to have a lot of entries)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the process of creating an iPhone app that requires to interact
I am in the process of creating an app, and one of the pieces
I'm in the process of creating an app. I'd like to have a pared
I'm in the process of creating a simple 2D game engine in C with
I am in the process of creating some fluent interfaces for some simple validation
I am in the process of creating an intranet site that accesses test data
I am in the process of creating a stored procedure. This stored procedure runs
Background: I am currently in the process of creating a simple VNC viewer embedded
I am in the process of creating a very simple RTS game as a
I am creating a simple web spider. All it does is accept a URL,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.