[中文简介] http://blog.sina.com.cn/s/blog_9eaa0f400102v9fd.html
Provide local connection pool like java
- PHP 5.3 + (no zts)
- linux 2.6+
- pdo and redis extension install
phpize=>./configure=>make install=>echo "extensions=xx/connect_pool.so">php.ini
##Technical characteristics:
- After each time fetchAll (set/get) call release() method, release the connection to the pool, avoid that the script jammed causing connection occupy high problem.
- The maximum and minimum number of connections configuration support.
- Support small pressure automatic recovery connection.
- Support graceful restart (reload).
- Do a lot of optimization, although the request through the connection pool process forward, but no loss of QPS.
- When the connection use out,support queue.
- Simple! just change the new method and add release function (see demon),you used the tcp pool.
- The connection proxy will start the ping process to monitor down list, if available will reflect to the return value of the get_disable_list(), use this function you can do some fun things,like LB.
- support Read / write separate and slave load balancing
step 1 move the pool.ini file to /etc/ and modify it as you need.
step 2 start the pool_server process:
```support "start" "stop" "restart" "reload"
step 3 modify you php script:
## 提示
- pool_server 必须以root用户启动
- redis不支持pub/sub方法
- 关于异常“you must release current pdo or redis connection before you get a new connection” 在新的版本中当你用完一个连接后(例如:fetchAll调用结束)没有调用release方法就再次new了其他的数据源会报这个错
这样做的目的是提醒你不要同时占用2个连接,这样是对资源的浪费,解决方案是在框架层每次fetch(或者get/set)用完之后调用release方法。
## contact us
- http://weibo.com/u/2661945152
- 83212019@qq.com
- qq群号 538716391