N
N
Nikita Sazonov2018-04-16 11:28:23
PHP
Nikita Sazonov, 2018-04-16 11:28:23

How to make multiple queries run at the same time?

How to run 2 or more queries at the same time?
I use curl, that is, the request goes like this:
$post = zapros_fun('wall.get', $params_wg);
$post2 = zapros_fun('user.get', $params_ug);
How can I make them run at the same time?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
GTRxShock, 2018-04-16
@GTRxShock

elementary
php.net/manual/ru/function.curl-multi-init.php
php.net/manual/en/function.curl-multi-exec.php

D
Dmitry Kim, 2018-04-16
@kimono

Simultaneously == run simultaneously in different scripts.
PS: you can also use queues to solve some problems. The simplest implementation is to create a task in a file, a console script in the background processes and deletes it.

X
xmoonlight, 2018-04-16
@xmoonlight

Read from here to the end.
And then - Parallel Programming with Pthreads in PHP - the Fu... .

F
fomenko_alexandr, 2018-04-16
@fomenko_alexandr

In your case, it is not even necessary to perform query parallelism on the side of your server.
VK has an execute method that simultaneously executes the script passed to it (which is faster than what is currently running)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question