Questions tagged [amphp]

Amp is a non-blocking concurrency framework for PHP applications.

Amp is a non-blocking concurrency framework for PHP applications. It's maintained by the amphp organization, which provides also other libraries based on Amp.

60 questions
0
votes
0 answers

Amphp/postgres parallel query execution

Trying to add some async magic to fully synchronous php application. I'm running php-fpm, amphp/amp:2.6.3, amphp/postgres:1.4.3, using NativeDriver or EventDriver - result is the same. I have 7 queries that don't have to be done sequentially and i'm…
Alez
  • 95
  • 3
  • 8
0
votes
1 answer

Using Amphp with a framework such as Magento

I am trying to use Amphp Parallel functions with the Magento framework in a custom module. try { $response = wait(parallelMap($items, function ($item) use ($arg1){ $this->getCustomItems( $item, $arg1); })); } catch…
Margue
  • 43
  • 6
0
votes
1 answer

amphp: Promises in Loops

Sorry, guys, but I'm kinda getting crazy now spending Hours and just can't figure out what's wrong. So I have a download class which needs to separate the download in chunks and then request each chunk as a separate request that's all fine where I'm…
0
votes
1 answer

AMP Parallel: failed to open stream: Too many open files in ClassLoader.php

While using AMPHP libraries for thread working tasks, I suddenly got the Warning and Error: PHP Warning: include(/.../vendor/amphp/process/lib/ProcessException.php): failed to open stream: Too many open files in /.../vendor/composer/ClassLoader.php…
ecairol
  • 6,233
  • 1
  • 27
  • 26
0
votes
1 answer

amphp auto-load class not working as expected

I'm trying to use a custom class in a worker using amphp but it doesn't seem to be working. The below class is already auto-loaded using composer. Please help me out with this issue. My code is below: Class (this implements Task as mentioned on…
Mr.Flocker
  • 181
  • 4
  • 13
0
votes
2 answers

PHP Amp\Mysql async slower than native blocking PDO?

I'm doing some testing with Amp and try to see how it could help speeding up SQL Queries by running them async. I think I'm doing something wrong because the results of this test file are very disappointing and not what I would have expected. Is…
floriank
  • 25,546
  • 9
  • 42
  • 66
0
votes
1 answer

AmPHP buffer keeps going forever

I've just picked up AmPHP and I'm trying to get the post body from my AmPHP http server, however, it keeps going forever (just never sends back a response to my client). This is the code I'm currently using: $resp =…
Finlay Roelofs
  • 533
  • 6
  • 21
0
votes
1 answer

amphp libary works on xampp but not on my webhoster

i want to execute domains in an array parallel. It works but only by xampp and not on my webhost. Why? I use this: https://github.com/amphp/parallel Code:
0
votes
0 answers

How to make post request with Artax

I am testing abilities php using laravel/lumen as server side framework. I have exisitng project and new task is to make multiple requests at the same time. I found amphp/parallel package which could help me. But documentation says to use Artax…
0
votes
2 answers

Amphp : Run many async loops with same connection (eventstore client)

I'm using eventstore client which uses amphp. I need inside my application to reuse the connection in many parts. So I created a connection provider: public function getConnection(): EventStoreConnection { if ($this->connection) { return…
Nek
  • 2,715
  • 1
  • 20
  • 34
0
votes
1 answer

AMPHP HTTP Client with usage proxies

I'm trying to use AMPHP HTTP-Client with proxies, and I cannot make it work. I'm using the example from their GitHub. (https://github.com/amphp/http-tunnel/blob/master/examples/http-client-via-proxy.php) I have to download 10 URLs and use a…
0
votes
1 answer

Problems with amphp with more than 1k concurrent tcp requests

I have created an application using the https://amphp.org framework. It is running with the help of a cronjob (every 5 minutes) sending a concurrent request to some sensors (temperatures) and it saves all the responses. Up to ~1K sensors everything…
leoshtika
  • 2,038
  • 1
  • 13
  • 10
0
votes
1 answer

Get websocket pings from an open stream connection using Amp\Websocket?

I am using the readme example here: https://github.com/amphp/websocket-client/blob/master/README.md use Amp\Websocket; use Amp\Delayed; use Amp\Websocket\Connection; use Amp\Websocket\Handshake; use Amp\Websocket\Message; use function…
tmarois
  • 2,424
  • 2
  • 31
  • 43
0
votes
1 answer

How to catch a php websocket broken TCP connection exception with Amphp?

Here is the current WebSocket loop I'm running while the connection is still alive. But after 11 hours of continuous connection, I received an exception "exception":"[object] (Amp\\Websocket\\ClosedException(code: 1006): The connection was closed:…
tmarois
  • 2,424
  • 2
  • 31
  • 43
0
votes
2 answers

How to send a message to ReactPHP/Amp/Swoole/etc. from PHP-FPM?

I'm thinking about making a worker script to handle async tasks on my server, using a framework such as ReactPHP, Amp or Swoole that would be running permanently as a service (I haven't made my choice between these frameworks yet, so solutions…
BenMorel
  • 34,448
  • 50
  • 182
  • 322