Design-station letter design ideas (based on millions of users)

Source: Internet
Author: User

As we all know, insite emails are divided into a small number (10-users), a large number (-users), and a large number (users) of different insite email architectures, which consume storage space and have different efficiency.

Based on the largest architecture, I will discuss with you how to design the insite email function to save more space. The following are some of my personal opinions:

The insite email function is:

1. Communication between users, such as emails.

2. The Administrator sends an insite email to the user.

3. Send messages to all users in the Administrator group (for million users, what should you do ?)

 

First, let's look at the database table relationships I designed:

Message table:

Messageid: ID column;Sendid: Sender ID;Recid: Recipient id;Textid: Message ID;Status: Identify read 1/unread 0;

Messagetext table:

Textid: ID column;Titel: Title;Text: Letter content;Time: Sending time;

Sysmessag table:

Sysid: ID column;Customerid: User ID column;Messageid: Message ID column;Sysstatus: System message read 1/unread 0;

A user needs to receive multiple system information, and each system information has a corresponding message status. Therefore, this table is used to determine the status of no system messages.

All ID columns are primary keys.

The relationships between the three tables are as follows:

The table design looks like this. Three tables are used.

Now it is time to test my design. If the Administrator sends a message to the user group with ID = 0, that is, recid = 0

I need to insert a record in the message table in the following format:

This system message has been recorded in the database

Currently, no user can read this message,Now simulateAssume that a user has logged on to the Account. The next step is:

1. First, read whether the message in the recid matches the user ID. The result is no;

2. Then match the number of system messages with recid = 0. Now there is one message with messageid = 1;

3. insert an existing record into the system message table sysmessag, as shown below:

By default, sysstatus is not read 0.

4. If there are multiple pieces of information, perform multiple insert operations. (what? Will there be a lot of system messages? Have you seen hundreds of system messages? Even if there are hundreds of data records, isn't it a problem to execute 100 inserts? --|)

5. Get the total number of messages + sysmessag and send the feedback to the front-end. The current value is 1.

Simulation ends here. O (partition _ partition) O

You can only modify the status of sysstatus in sysmessag, but cannot modify the status in the message table. I think this is controllable.

(What? When you send a message, do you enter recid = 0? You cannot control this permission problem? Then I really don't know what to say. ^_^)

With million users, they only occupy storage space based on active users. inactive users do not have to worry about wasted storage space.

After reading this article, I think you may have your own opinions on the design of insite emails. You are welcome to comment on it and provide your valuable comments so that I can learn more about the problem. Thank you.

 

Reprinted please indicate the source, this is written to the authorArticleYes. Thank you.

 

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.