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 ...
随机推荐
- [笔记] 升級到 Delphi 10.2 Tokyo 笔记
升級到 Delphi 10.2 Tokyo 笔记: 更新 Xcode 8.3 & iOS 10.3 测试: macOS 没问题(可 Debug) iOS Simulator 没问题(可 Deb ...
- jenkins + ansible + docker 代码集成发布
一.环境搭建 1. 安装Java 配java_home, /etc/profile 2.安装Jenkins 下载war包,用 Java -jar Jenkins.war或者 把war包放tomca ...
- go字符串转换
package main import ( "fmt" "strconv" ) /* 常用总结 1.str 转 int a, _ := strconv.Atoi ...
- anaconda安装包找不到
Anaconda作为一个工具包集成管理工具,下载python工具包是很方便的,直接敲: conda install package_name 1 但是有时候安装一个工具包(如skimage)的时候,在 ...
- 20155234java实验一
实验内容 1.使用JDK编译.运行简单的Java程序: 2.使用Eclipse 编辑.编译.运行.调试Java程序. 实验要求 1.没有Linux基础的同学建议先学习Linux基础入门(新版))Vim ...
- 20155306 实验四 Android程序设计
20155306 实验四 Android程序设计 实验内容 1.基于Android Studio开发简单的Android应用并部署测试; 2.了解Android.组件.布局管理器的使用: 3.掌握An ...
- aspnetcore 2.1 发布到树莓派3linux的艰辛路程
发布至docker for windows. 提示: image operating system "windows" cannot be used on this platfor ...
- [agc006D]Median Pyramid Hard-[二分+乱搞]
Description 题目大意:给你一个长度为n*2-1的排列,将除了该序列头尾的两个数外的其他数(设为i)变为原序列i-1,i,i+1下标数的中位数.求最后的数是什么.例子如下: Solution ...
- Drupal7 针对特定条件才显示区块
当D7中开启PHP filter模块. Text format就会多出“PHP Code”选项. 而且,新建block时也会多出"Pages on which PHP code return ...
- CentOS-6.4 minimal - 安装VMware Tools(linux)
本文参考自:http://www.cnblogs.com/xyq/p/4068018.html 1.挂载光驱 2./mnt下面默认显示以下文件 3.卸载/mnt 4.点击安装VMware Tools ...