Home  >  Article  >  Backend Development  >  javascript - Submitting data to the interface multiple times, how to ensure data integrity and alleviate insertion pressure?

javascript - Submitting data to the interface multiple times, how to ensure data integrity and alleviate insertion pressure?

WBOY
WBOYOriginal
2016-08-04 09:19:34956browse

Use ajax to collect article data by date. The number of articles per day is not necessarily certain. It may be a few articles, or it may be several thousand or tens of thousands.
One submission cannot submit one day's data to the server at once.
1. Assume that 1,000 articles are submitted, divided into 10 submissions, each of 100 articles (about 80k). How to ensure that the final server saves these 1,000 articles to the database (cannot be repeated)?
2. If multiple clients submit data at the same time, how to alleviate the insertion pressure on the database?

Reply content:

Use ajax to collect article data by date. The number of articles per day is not necessarily certain. It may be a few articles, or it may be several thousand or tens of thousands.
One submission cannot submit one day's data to the server at once.
1. Assume that 1,000 articles are submitted, divided into 10 submissions, each of 100 articles (about 80k). How to ensure that the final server saves these 1,000 articles to the database (cannot be repeated)?
2. If multiple clients submit data at the same time, how to alleviate the insertion pressure on the database?

You can give all the article IDs first, and then the server checks them through this batch of article IDs. If it is not so strict, you can only give the total number that needs to be updated, and then the server verifies whether all the updates have been completed after the server updates it

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn