Home  >  Article  >  Backend Development  >  Timeout problem when reading data through the interface and writing to the database

Timeout problem when reading data through the interface and writing to the database

WBOY
WBOYOriginal
2016-12-01 01:27:391403browse

There are 1,000 product numbers. If you go to the interface to retrieve product details one by one through the numbers and then write them into the database, writing directly will time out. Is there any good method? ?

Reply content:

There are 1,000 product numbers. If you go to the interface to retrieve product details one by one through the numbers and then write them into the database, writing directly will time out. Is there any good method? ?

After obtaining all the information, insert it at once. If the amount of data is too large, you can split it and obtain it several times, and then insert it in batches

A better way is to store the product number (can be in database, redis, memcahced, etc.), use crontab to regularly obtain several pieces of information in batches each time, insert them into the database, and modify the stored number identification status. The cruder thing is to modify the php process time limit field in the php environment configuration

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