amphp / mysql

An async MySQL client for PHP, optimizing database interactions with efficient non-blocking capabilities. Perfect for responsive, high-performance applications.
Other
356 stars 63 forks source link

v2: is it possible to set a limit on the max number of parallel connections? #134

Closed ethaniel closed 1 month ago

ethaniel commented 1 month ago

Hi! I have about 200 SQL queries that I need to perform. Is it possible to limit the concurrency in v2 of amphp/mysql? So let's say that if want to have 10 queries always running in parallel, if one finishes - then another one from the queue takes it place. Thank you.

bwoebi commented 1 month ago

The constructor has a maxConnections argument: https://github.com/amphp/sql-common/blob/1.x/src/ConnectionPool.php#L114

kelunik commented 1 month ago

You should likely also have a look at Pipeline in amphp/pipeline to control concurrency: https://github.com/amphp/pipeline?tab=readme-ov-file#pipeline