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 306419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:27:55+00:00 2026-05-12T07:27:55+00:00

I have a social network The users table is around 60,000 rows The friends

  • 0

I have a social network

  • The users table is around 60,000 rows

  • The friends table is around 1 million
    rows (used to determine who is your
    friend)

I am wanting to do a friend feed, wall, whatever you like to call it, it will show things like user status post (twitter type posts), it will show a few different items but for the start it will just be friend status and maybe blog post.

Basicly you will only see content published with a user ID that is in your friend list.

I have been trying to come up with the best way and haven’t gotten very far but here is my latest idea.

Currently to build this feed, I have to

  1. Get the list of friend ID’s on the
    large friend table

  2. Get the stream data from the friend
    ids from the above result

  3. JOIN the user table to get the
    publishers picture URL and username

  4. Then JOIN the comments table to get
    comments posted on the feed items

That is one big task to build that feed

I have 3 ideas so far, this is where your help can come in.

Memcache Option:

  1. Use memcache and cache a users
    friendlist as an array when the user
    logs into the site, also when the user
    approves a new friend request for a
    friend to be added to there list, it
    would rebuild there cache.
  2. In addition to just getting there friends I could save there friends picture URL and username, this would speed up things again by eliminating this query when building the friend feed.

File cache Option:

  1. Do the same as the memcache option
    does but save this data as an array
    to a cache file instead of memory,
    then include this cache file into
    the page.

  2. I am not sure which is the best
    method for performance I understand
    memcache stores everything in memory
    so friends that have like 20,000
    friends that could use a lot of
    memory and a file cache would only
    put it in memory when the users
    needs it if I am correct. Also if I
    did the file method, when a user
    logs out of the site, I would delete
    there cache file so the cache folder
    would never be too large of files

Session cache Option:

  1. Same as file cache above, I just realized that session data is saved into a file so wouldn’t that make it capable of being a cache?

Please give me your opinions or any advice or info you have on this as I don’t have much knowledge of caching, I have read a lot but sometimes other peoples ideas help a lot

  • 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-05-12T07:27:55+00:00Added an answer on May 12, 2026 at 7:27 am

    Memcache is your best bet for a lot of reasons:

    1. It’s REALLY fast – Everything’s in memory, and it’s highly optimized for situations just like yours (and caching in general 🙂
    2. It’s distributed – This means that if you have multiple web / app servers running, they can all access the same cache
    3. You can pool multiple servers for memcache – If you’ve got a few servers that are relatively underutilized (or several dedicated cache servers), you can pool them all together into one big cache
    4. It’s super-scalable (for the reasons mentioned prior)
    5. It’s got great PHP support – The PECL package for memcache was recently updated with a lot of new goodness
    6. You can even store your user sessions in memcache – just set it up in your php.ini file. This is much faster than storing sessions in databases, and allows your sessions to persist across multiple web hosts (if you’re in a load balanced situation)… this will also give your site a bit of a performance boost as there’s no need to hit the filesystem / database for session info on every request.

    … and many more 😉

    As to some of your concerns about memory footprint of individual cached items you’ve got a few options. My initial thought is to just give it a whirl, see how big these cache items really get (you can find several open-source things to monitor the actual cache usage, such as cacti). I think they’ll be smaller than you’d think.

    If they’re not, I’d suggest re-thinking your cache strategy as far as what you actually cache, for how long, etc. Maybe you could build the feed from several things already in the cache (i.e. cache individual user data, and then build the feed for a person from all those individual items in cache). There are a lot of good articles out there on that front, just search ’em out 🙂

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

Sidebar

Related Questions

OK I have a social network, around 50,000 users so far and there is
On a social network I am working on in PHP/MySQL, I have a friends
For storing friends relationships in social networks, is it better to have another table
I have a social network that allows users to write blogs and ask questions.
I have this problem. Given a users table that consists of users' username in
I have a social network similar to myspace but I use PHP and mysql,
I have a pretty large social network type site I have working on for
I'm creating a social network in Rails and I have a model like this:
I am trying to integrate facebook connect with nmy social network site, currently users
Practicing web development by making a social network. Users can earn points for performing

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.