-
MySQL Connector/Python 1.1.1 and up supports simple connection pooling that has these characteristics
-
自1.1.1版本后就支持简单的连接池了,下面是它所具有的特性
-
-
The mysql.connector.pooling module implements pooling.
-
mysql.connector.pooling 模块继承了pooling模块
-
A pool opens a number of connections and handles thread safety when providing connections to
requesters.
-
当为请求者提供连接的时候,连接池会打开大量的连接并且会处理线程安全
-
The size of a connection pool is configurable at pool creation time. It cannot be resized thereafter.
-
连接池的大小在连接池创建的时候是可以指明的,这点跟python的进程池操作一致,而且在创建以后大小不能再被更改
-
A connection pool can be named at pool creation time. If no name is given, one is generated using the connection parameters.
-
在连接池创建的时候可以给其命名,否则,它会用连接参数生成一个名字
-
The connection pool name can be retrieved from the connection pool or connections obtained from it.
-
连接池的名字可以从连接池中取回或者从和它建立的连接那里得到
-
It is possible to have multiple connection pools. This enables applications to support pools of connections to different MySQL servers, for example.
-
你可以应用多个连接池,比如:这可以使应用可以支持不同的MySQL服务器的连接池
-
For each connection request, the pool provides the next available connection. No round-robin or other scheduling algorithm is used. If a pool is exhausted, a PoolError is raised.
-
对每一个不同的连接请求,连接池都提供了下一个可用的连接,并没有应用轮询或者调度算法,如果一个进程池连接耗尽了,它会报出一个PoolError异常
-
It is possible to reconfigure the connection parameters used by a pool. These apply to connections obtained from the pool thereafter. Reconfiguring individual connections obtained from the pool by calling the connection config() method is not supported.
Applications that can benefit from connection-pooling capability include: 你的应用可以从连接池的包含的方法中受益
-
python-MySQL学习笔记-第六章-Connector/Python连接池(Connection Pooling)
最新推荐文章于 2025-06-18 10:08:10 发布