Answer the question
In order to leave comments, you need to log in
Why does the API VPS receive 300 requests and then stop receiving responses from the server?
There is a script that receives data via the API. (See below)
The amount of data is large (30 thousand products). For each Launch, information is obtained for 100 products, the operating time is approximately 40 seconds / 100 products. Launched via cron.
Works locally. But on the server, 300-500 goods are received and the source, as it were, stops giving data. Initially, the script just hung, then I added a timeout for the CURLOPT_CONNECTTIMEOUT connection to 5 seconds and all connections are torn by timeout (the standard return time is 0.2-0.8 seconds, depending on the load of the source server). The lead time is 502-503sec, just 5sec*100 items.
I can’t understand why everything is given to the LAN, but the German VPS server has a limited amount of issuance. I also tried it on another VPS (in the Russian Federation), worked out about 1200 goods, the flight was normal. Impression that the problem settings of the server.
if ($curl = curl_init()) {
// устанавливаем параметры предстоящего запроса
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Content-Type: application/xml", "Authorization: Basic " . base64_encode($USER_NAME.":".$USER_PASS)));
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);//Сколько времени ждем ответ от сервера в секундах.
$out = curl_exec($curl);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question