How to implement two-dimensional interpersonal relationships similar to the pulse Network

Source: Internet
Author: User
The following are simplified Data and Scenario Data User information: User ID [ID], user NAME [NAME] user relationship: user ID1 [UID1], user ID2 [UID2], LABEL [LABEL] user status: User ID [UID],... the following are simplified data and scenarios:

============================================================ ==============

  1. User information:
    User ID [ID] and user NAME [NAME]

  2. User relationship:
    User ID1 [UID1], user ID2 [UID2], LABEL [LABEL]

  3. User status:
    User ID [UID], CONTENT [CONTENT]

======================================================= ==============

  1. Assume that three users exist.
    ID | NAME
    1 |
    2 | B
    3 | C

  2. Mutual Relationship:
    UID1 | UID2 | LABEL
    1 | 2 | relative
    2 | 3 | colleague

  3. Scenario:
    A. Publish A status.
    UID | CONTENT
    1 | hello world !!

======================================================= ================
C can see the release status of A, and know that this status is released by colleague B's relative.

========================================================= ================
What is the simplest and easiest way to understand the minimum pressure on the system ????

=================================================== ==========

Currently, I have two solutions.
1. Only one status is recorded. Users who follow two dimensions can query this status through the link.
Advantage: simple logic
Disadvantage: system pressure exponential growth
2. Record the redundancy status. When a user publishes a status, all users with two-dimensional attention record a status.
Advantage: low system pressure
Disadvantage: large data redundancy

Reply content:

The following are simplified data and scenarios:

============================================================ ==============

  1. User information:
    User ID [ID] and user NAME [NAME]

  2. User relationship:
    User ID1 [UID1], user ID2 [UID2], LABEL [LABEL]

  3. User status:
    User ID [UID], CONTENT [CONTENT]

======================================================= ==============

  1. Assume that three users exist.
    ID | NAME
    1 |
    2 | B
    3 | C

  2. Mutual Relationship:
    UID1 | UID2 | LABEL
    1 | 2 | relative
    2 | 3 | colleague

  3. Scenario:
    A. Publish A status.
    UID | CONTENT
    1 | hello world !!

======================================================= ================
C can see the release status of A, and know that this status is released by colleague B's relative.

========================================================= ================
What is the simplest and easiest way to understand the minimum pressure on the system ????

=================================================== ==========

Currently, I have two solutions.
1. Only one status is recorded. Users who follow two dimensions can query this status through the link.
Advantage: simple logic
Disadvantage: system pressure exponential growth
2. Record the redundancy status. When a user publishes a status, all users with two-dimensional attention record a status.
Advantage: low system pressure
Disadvantage: large data redundancy

First, because memcache redis and the second solution can be used during user growth.

Is it okay to redundant an ID. In addition, I think redundancy can be easily divided into two layers: relationship, relationship Content ID, and relationship Content ID. Of course, you can also consider this directly redundant content.
The read permission Code made by the circle of friends is non-redundant. It is calculated when the code is directly read. This is because it needs to be dynamically adjusted based on whether it is a friend or not.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.