Home > Article > Backend Development > Timeout problem when reading data through the interface and writing to the database
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? ?
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