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

WBOY
Release: 2023-03-02 12:20:02
Original
1362 people have browsed it

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

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!