Reputation: 1031
I have the following code:
$client = new GuzzleHttp\Client(
array(
'base_uri' => 'https://somesite.com'
)
);
$response = $client->request('POST', '/api', [
'form_params' => array(
'action' => 'getusers',
'api_key' => $_POST['key'],
'id' => $_POST['id']
)
]);
When multiple users are accessing the same page with the following code above, other users waits for the first or recent request to finish before loading its request.
I'm not using any session
.
I have tag curl
because guzzle is built on top of it. Maybe it has something to do with it?
Any workaround for this?
using xhr
won't fix it because the site I'm requesting for the API does not accept other origins.
Upvotes: 1
Views: 1271
Reputation: 5010
Check available PHP processes if you are using PHP FPM. It has a status page (the setup is described there) to get this information.
If all the workers are busy, then client's requests will wait. You need to increase the amount of workers to be able to process more requests at once.
Upvotes: 1