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 ...
随机推荐
- django的数据库操作-16
目录 增 1.save 2.create 查 1.基本查询 2.过滤查询 3. F对象 4. Q对象 5. 聚合函数 6. 排序 7. 关联查询 8. 关联+过滤查询 删 改 1. save 2. u ...
- Python学习:16.Python面对对象(三、反射,构造方法,静态字段,静态方法)
一.构造方法 在使用类创建对象的时候(就是类后面加括号)就自动执行__init__方法. class A: def __init__(self): print('A') class B: def __ ...
- python2.7提示编码出错
学习python过程中经常会遇到一些问题. 比如编码出错,之前解决过.但是由于很长时间没有学习python,于是忘记解决的办法.这一次,从新开始学习又遇到了... 首先,报错提示编码出现问题: 于是通 ...
- SpringBoot 启动报The Java Virtual Machine has not been configured to use the desired default character encoding (UTF-8)
解决方法: 启动的时候在VM中添加 Dfile.encoding=UTF-8 就好了!
- 20155220 2016-2017-2《Java程序设计》第五周学习总结
20155220 2016-2017-2<Java程序设计>第五周学习总结 教材学习内容总结 异常处理 Java异常处理通过5个关键字try.catch.throw.throws.fina ...
- 342. Power of Four(One-line)
342. Power of Four Total Accepted: 707 Total Submissions: 2005 Difficulty: Easy Given an integer ...
- tomcat如何禁止显示目录和文件列表
打开 tomcat的安装目录/conf/web.xml 文件 找到: <servlet> <servlet-name>default</servlet-name& ...
- [Bootstrap 源码解析]——bootstrap源码之初始化
bootstrap源码之初始化 我们先来分析normalize.less编译后的源码,我们知道normalize.css是一个专门将不同浏览器的默认css特性设置为统一效果的css库,它和reset. ...
- javaweb(十四)——JSP原理
一.什么是JSP? JSP全称是Java Server Pages,它和servle技术一样,都是SUN公司定义的一种用于开发动态web资源的技术. JSP这门技术的最大的特点在于,写jsp就像在写h ...
- Migrating to WebSphere 9
Migrating to WebSphere 9 Make a migration plan Requirements Migrate WebSphere profiles into the new ...