Unfortunately, I can’t show you the code, but I can give you an idea of what it looks like, what it does and what I have a problem ...
<?php
include(db.php);
include(tools.php);
$c = new GetDB();
$t = new Tools();
if(isset($_POST['var'])){
$nv = json_decode($_POST['var'])
foreach($nv as $k) {
$id = $t->clean($k->id);
$id = $c->real_escape_string($id);
$q = $c->query("SELECT * FROM table WHERE id = '$id'");
$r = $q->fetch_row();
if ($r[1] > 0) {
$q1 = $c->query(UPDATE TABLE1);
$q4 = $c->query(UPDATE TABLE2);
if ($x == 1) {
$q2 = $c->query(SELECT);
$rq = $q2->fetch_row();
if ($rq[0] > 0) {
$q3 = $c->query(UPDATE TABLE3);
} else {
$q3 = $c->query(INSERT TABLE3);
}
}
} else {
$q1 = $c->query(INSERT TABLE1);
$q4 = $c->query(INSERT TABLE2);
$q3 = $c->query(INSERT TABLE4);
if($x == 1) {
$q5 = $c->query(INSERT TABLE3);
}
}
}
}
As you can see, these are very simple INSERT, UPDATE script tables, so before we get to the full version, we did some tests to see that the script works as it should, and the “result”, where it’s fine ...
Thus , we ran this code against 100 requests, everything when it’s just fine ... less than 1.7 seconds for 100 requests ... but then we saw the amount of data that needed to be sent / sent, it was a jaw shot for me .. . more than 20 thousand elements are required to send from 3 to 5 minutes, but the script always crashes "data" - this is an array in json
array (
[0] => array (
[id] => 1,
[val2] => 1,
[val3] => 1,
[val4] => 1,
[val5] => 1,
[val6] => 1,
[val7] => 1,
[val8] => 1,
[val8] => 1,
[val9] => 1,
[val10] => 1
),
[1] => array (
[id] => 2,
[val2] => 2,
[val3] => 2,
[val4] => 2,
[val5] => 2,
[val6] => 2,
[val7] => 2,
[val8] => 2,
[val8] => 2,
[val9] => 2,
[val10] => 2
),
)
json... , , , 3 5 - , , , ... , 503, , , -, VPS max_execution_time , , 10K +, 1 VPS, max_execution_time... , , 10K + , 1K , ... ... ... "" , , , 1K , , , ... ?