erlang驱动使用mysql-otp
Magnus Ahltorp的Mysql Driver里面介绍emysql的缺陷:
1. 隔离不够好,
2.不能伸缩
mysql-otp使用1个进程1个mysql连接,隔离得很好。推荐使用。
mysql-otp-poolboy 使用poolboy + erlang-otp 来形成线程池,使用poolboy来避免线程数量不足或者过多的情况。
参考:which erlang's pool is suitable?
poolboy automatically reduces workers when there is not work for them. You get a worker to do some work with checkout from the pool, and you release the worker with checking, as an alternative, you enclose the work on transaction which automatically checkouts the worker and after its done it checkins the worker. When you start the pool, poolboy automatically creates a number of size workers, waiting to handle some work. When you call checkout, poolboy tries to get one of the workers which is already started, if all of the workers are already checkout because they are doing some work, it checks its max_overflow configuration and it starts to create workers to handle the load until it reaches max_overflow. When a worker is released, if there are not more jobs for the workers, they are killed. So if you create a pool like {pool, [
{size, 100},
{max_overflow, 900}
]}
size表明最少进程池的数量,max_overflow表明如果进程池没有空闲进程,则最多新开多少个进程数量。
推荐使用mysql-otp-poolboy。
erlang驱动使用mysql-otp的更多相关文章
- Centos6.4安装erlang并配置mysql数据库
在安装时,一定要使用Centos6.4光盘为yum源,否则可能使用了版本有问题的openssl 1.首先要先安装GCC GCC-C++ Openssl等依赖模块: yum -y install mak ...
- MySQL 读写分离 使用驱动com.mysql.jdbc.ReplicationDriver
说明文档:http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html 代码例子: ...
- ThinkPHP数据库驱动之mysql事物回滚
1.开启事务方法 startTrans()2.事务提交方法 commit()3.事务回滚方法 rollback() 用法例子: $order = M(‘order’); $allAdded = tru ...
- MySQL JDBC驱动版本与MySQL数据库版本对应关系
前言:前段时间发现在家使用和公司一样的mysql jdbc驱动版本发生了异常,原因:家里mysql数据库版本与公司不一致导致.查询了相关资料,发现mysql jdbc驱动版本与mysql数据库版本有一 ...
- 转载: erlang连接mysql
转自:http://blog.csdn.net/flyinmind/article/details/7740540 项目中用到erlang,同时也用到mysql.惯例,google. 但是,按照网上说 ...
- IntelliJ IDEA+Mysql connecter/j JDBC驱动连接
在IntelliJ IDEA中用connecter/j jdbc驱动连接MYSQL 以下是解决过程,待整合...有点懒,有空再改 官方文档:https://www.cnblogs.com/cn-chy ...
- erlang连接mysql [转]
转自: http://blog.csdn.net/flyinmind/article/details/7740540 项目中用到erlang,同时也用到mysql.惯例,google. 但是,按照网上 ...
- erlang连接mysql
http://blog.csdn.net/flyinmind/article/details/7740540 项目中用到erlang,同时也用到mysql.惯例,google. 但是,按照网上说的做, ...
- windows下编译qt的mysql驱动
windows下编译qt的mysql驱动cd %QTDIR%\src\plugins\sqldrivers\mysqlqmake –o Makefile INCLUDEPATH+="C:\M ...
随机推荐
- 选择区域缩放Flex Chart
http://www.riafan.com/zoom-chart/ 演示地址: http://www.riafan.com/flash/zoomchart/ 下载地址: http://www.riaf ...
- 20155230 2016-2017-2 《Java程序设计》第十周学习总结
20155230 2016-2017-2 <Java程序设计>第十周学习总结 教材学习内容总结 网络编程:就是在两个或两个以上的设备(例如计算机)之间传输数据.程序员所作的事情就是把数据发 ...
- 20155302 2016-2017-2 《Java程序设计》 第1周学习总结
20155302 2016-2017-2 <Java程序设计> 第1周学习总结 教材学习内容总结 浏览全书提出问题 chapter1:怎么保证现在系统在用最高版本的JRE呢?在哪里查看及升 ...
- 基于 OpenCV 的人脸识别
基于 OpenCV 的人脸识别 一点背景知识 OpenCV 是一个开源的计算机视觉和机器学习库.它包含成千上万优化过的算法,为各种计算机视觉应用提供了一个通用工具包.根据这个项目的关于页面,OpenC ...
- 【LG3233】[HNOI2014]世界树
题面 洛谷 题解 代码 #include <iostream> #include <cstdio> #include <cstdlib> #include < ...
- 接口文档神器Swagger(下篇)
本文来自网易云社区 作者:李哲 二.Swagger-springmvc原理解析 上面介绍了如何将springmvc和springboot与swagger结合,通过简单配置生成接口文档,以及介绍了swa ...
- c# 实体类怎么给LIST赋值,table转LIST
/// <summary> /// 缓存客服集合信息 /// </summary> public class model { /// <summary> /// 客 ...
- MVC捕获数据保存时的具体字段验证错误代码
////捕获验证错误代码 //try //{ // // 调试写数据库 //} //catch (DbEntityValidationException dbEx) //{ //}
- 解决webstorm中测试dva项目run start命令需要不断重启问题
用dva-cli构建了项目之后在webstorm开发,用npm start跑本地服务,经常修改之后在浏览器刷新没反应,偶尔才会有刷新,需要重新跑一遍npm start才会更新,这是怎么回事呢? web ...
- 前端之JavaScript(一)
一.JavaScript前世今生 它最初由Netscape的Brendan Eich设计.JavaScript是甲骨文公司的注册商标.Ecma国际以JavaScript为基础制定了ECMAScript ...