Download the PHP package allsilaevex/swoole-connection-pool without Composer

On this page you can find all versions of the php package allsilaevex/swoole-connection-pool. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package swoole-connection-pool

Swoole Connection Pool

A solid, flexible and high-performance Swoole based connection pool.

PHP Programming Language Download Package CI Status Codecov Code Coverage Psalm Type Coverage PHPStan level Psalm level License

⚙️ Installation

Requirements

[!WARNING] Pool has not been tested with swoole.enable_preemptive_scheduler = 1. Use at your own risk!

⚡️ Quickstart

This example demonstrates the creation of a simple pool of connections to the MySQL database.

✨ Features

❓ Why should I use a connection pool?

The most obvious reason: connection pool saves time by not establishing a new connection for each request.

A less obvious reason lies in the way Swoole and coroutines work. By design, it's not possible to use the same connection simultaneously in two different coroutines, which means you must create a separate connection for each coroutine. This adds extra overhead compared to using a single connection sequentially. It can also lead to uncontrolled growth in the number of connections.

And the least obvious issue: slowdowns due to multiple context switches during execution. Context switching occurs during IO operations, including establishing a connection. Thus, the execution flow of the following code may not be obvious:

What happens if a CPU-bound load appears in the second coroutine? Since coroutines are executed within the same process, they cannot parallelize the execution of CPU-bound code. Therefore, if one coroutine is executing PHP code, the others will wait. So, the execution of query will be deferred until the second coroutine finishes its work and returns control back to the first coroutine.

🚀 Benchmarks

Without connection pool:

With connection pool:

Read more about the tests in the document.

🔧 Configuration

For simplifying configuration and creating a pool, there's the ConnectionPoolFactory. The factory comes with default settings, but it's highly recommended to customize the parameters according to your specific needs.

The following example demonstrates the configuration options:

License

MIT


All versions of swoole-connection-pool with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-swoole Version ^5.1 || ^6.0
psr/log Version 3.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package allsilaevex/swoole-connection-pool contains the following files

Loading the files please wait ....