Questions about using PHP to simulate WeChat Moments

Source: Internet
Author: User
Questions about PHP simulated circle of friends data, such as A circle of friends with N comments

When A user enters the circle of friends to refresh the latest 10 items, for example, each circle of friends has N comments, the data calculation formula to be called is R = (A * N) * 10.

My problem is: this method of data retrieval puts a lot of pressure on the database. it takes the first time for the database to be fully retrieved, but the circle of friends is short so fast. please kindly advise.


Reply to discussion (solution)

Databases are also used, but not relational databases, but memory-based NOSQL databases.

Relational databases are based on hard disks, and the speed is naturally slower.
Therefore, the speed is burned out by money.

Query method? I still want to query 10 friends first and then query the comments in each circle of friends in sequence?

Relational databases are based on hard disks, and the speed is naturally slower.
Therefore, the speed is burned out by money.



Query method? I still want to query 10 friends first and then query the comments in each circle of friends in sequence?

Yes!
This is where key-value pairs are queried.
In fact, it is slower than the associated query, but the carrier is different, it seems faster

Yes!
This is where key-value pairs are queried.
In fact, it is slower than the associated query, but the carrier is different, it seems faster



Thank you. in addition to improving the performance of nosql and hardware, what other methods can be used to increase the query speed in the language itself?

No!
Of course, the premise is that you have adopted the speed-up suggestions provided by the database (or prove invalid)

No!
Of course, the premise is that you have adopted the speed-up suggestions provided by the database (or prove invalid)



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.