Search code examples
amphp

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 is working fine.

When increased to 1.5k for about 30% of the requests I am getting the following message:

Connecting to tcp://...:502 failed: timeout exceeded (10000 ms)

Any suggestions would be greatly appreciated!


Solution

  • There's usually a limit of up to 1024 file descriptors with stream_select, so you'll need one of the extensions, see https://github.com/amphp/amp#requirements.