small/doctrine-dbal-swoole-pdo-driver
Composer 安装命令:
composer require small/doctrine-dbal-swoole-pdo-driver
包简介
README 文档
README

OpenSwoole and Doctrine
Connection issue
The doctrinal issue is that coroutines use the same connection.
On a service with many connections, users end up waiting for SQL queries to finish one after the other.
Solutions
1) Create a connection for each request
This solution has been adopted in the package diego-ninja/swoole-mysql-doctrine-driver : diego-ninja/swoole-mysql-doctrine-driver
Two issues arise:
- We are in a long-time process, and connections consume RAM.
- Under heavy load, database server may block due to a large number of open connections.
2) Use a connection pool
The connection pool is a class replacing native driver that store and reuse connections. You can define the max number of concurent connections, determined by the size of your database server.
The process is simple :
For example : we use a pool of 10 connections.
If there is a free connection, we get the connection. Send the connection and release the connection.
If there is no free connections, we sleep a short time and retry.
small/swoole-pdo-doctrine-driver
This package use small/swoole-patterns abstract pool's class.
Here is an example to configure it with symfony :
doctrine:
dbal:
driver: Small\SwooleDbalPdo
url: '%env(resolve:DATABASE_URL)%'
The source code is available on https://git.small-project.dev/lib/small-swoole-doctine-dbal-pdo
The composer package is available on https://packagist.org/packages/small/small-swoole-doctine-dbal-pdo
small/doctrine-dbal-swoole-pdo-driver 适用场景与选型建议
small/doctrine-dbal-swoole-pdo-driver 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 04 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「dbal」 「mysql」 「doctrine」 「pdo」 「async」 「driver」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 small/doctrine-dbal-swoole-pdo-driver 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 small/doctrine-dbal-swoole-pdo-driver 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 small/doctrine-dbal-swoole-pdo-driver 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
A custom Doctine DBAL type to use PHP DateTime objects set to the system's default timezone.
Make pimcore migration simple
Use a REST API as if it was your local database
Plugins for Tactician commands using Doctrine, like wrapping every command in a transaction
Use FileMaker through CWP as your backend database
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-30