When posting a post (or article) on a website, you need to operate on multiple data tables. Are these operations completed at one time?

Source: Internet
Author: User
Tags website performance
When posting a post, a website usually needs to operate on multiple data tables. For example, to post a post, you need to insert the post table, and then insert the post tag post_tag relational table, insert the post_user post follow table, update the number of posts in the tag table, and update the number of posts in the user table... when posting a post, a website usually needs to operate on multiple data tables. For example, to post a post, you need to insert the post table, and then insert the post tag post_tag relational table, insert the post_user post follow table, update the number of posts in the tag table, and update the number of posts and points in the user table. Are these operations performed on multiple data tables completed at one time, or are other methods used? It takes a long time to complete the task at one time. A message is also sent when a reply or comment is posted. When displaying a post, you must update the page views of the post. I don't know what the role of beanstalkd is. I have seen this in the official php phalcon framework sample forum. I don't know if it is useful for solving these problems?

Reply content:

When posting a post, a website usually needs to operate on multiple data tables. For example, to post a post, you need to insert the post table, and then insert the post tag post_tag relational table, insert the post_user post follow table, update the number of posts in the tag table, and update the number of posts and points in the user table. Are these operations performed on multiple data tables completed at one time, or are other methods used? It takes a long time to complete the task at one time. A message is also sent when a reply or comment is posted. When displaying a post, you must update the page views of the post. I don't know what the role of beanstalkd is. I have seen this in the official php phalcon framework sample forum. I don't know if it is useful for solving these problems?

The website performance lies in the database, but for many websites, there is not much data written at the same time.

You can perform the following Optimization Based on your situation:
1. Data Association Optimization
The association between post and tag can be simply saved to the IDs of the two,
Post_tags, 101xxx, 103xxx
2. asynchronous processing of points and notifications
3. Use the cache to process frequently read/write data
The browser views can be written to the cache first, and then written to the database once per 50 browser views, for example, based on the actual situation.

Generally, it is based on the transaction integrity of the operation. If the operation is complete, the background is completed at one time. If not, you can complete the operation in multiple ways, as described in multiple methods on the first floor!

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.