Z
Z
Zakharov Alexander2016-11-21 15:16:59
linux
Zakharov Alexander, 2016-11-21 15:16:59

php curl multi user requests?

Hello.
There is a linux/apache (2.4.23)/php (5.6.27)/ curl (7.50.3) server. It has requests that are redirected using curl to another server. Well, the forwarding works very slowly. After testing the load on several users, it turned out that requests through curl go one at a time. Those. in order for the next user to perform a curl request, then php waits until the first user's request is processed. It seems that curl does not work in parallel on multiple users. Is this true and is there any way to get around it?
PS - clarification:
I know that there is curl_multi_init / curl_multi_exec, but as far as I understand, this is intended for the case when one user needs to perform several parallel requests in one session. I need curl to run in parallel in several sessions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PrAw, 2016-11-21
@AlexZaharow

1. Make sure that the remote server on your computer can give several pages at the same time. For example Apache ab:
Be careful! Comparable to a DoS load attack, make sure that the other side will be happy to receive you. Will request the same url in several threads.
2. Make sure that the local server has enough power to simply serve pages to several threads with the same ab
3. Try not to work with the PHP module, but call via php.net/manual/ru/function.passthru.php
UNSAFE, just for the sake of testing.
4. Try not to start the session in the test script (I'm not sure what is the reason, but there is a blockage).
And when you exclude everything outside of cUrl, it will already be possible to poke around with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question