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。

时间: 2024-07-29 12:39:28

erlang驱动使用mysql-otp的相关文章

MySQL 读写分离 使用驱动com.mysql.jdbc.ReplicationDriver

说明文档:http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html 代码例子: 1 import java.sql.Connection; 2 import java.sql.ResultSet; 3 import java.util.Properties; 4 5 import com.mysql.jdbc.ReplicationDriver; 6 7 public clas

Centos6.4安装erlang并配置mysql数据库

在安装时,一定要使用Centos6.4光盘为yum源,否则可能使用了版本有问题的openssl 1.首先要先安装GCC GCC-C++ Openssl等依赖模块: yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel 2.再安装ncurses模块 yum -y install ncurses-devel yum install ncurses-devel 3.下载Erang源代码文件otp_src_

[Erlang危机](1.3)OTP应用

?? 1.OTP Applications Figuring out OTP applications is usually rather simple. They usually all share a directory structure that looks like: ?搞清楚 OTP applications通常都非常简单,他们通常在同一个目录下, 目标结构如下: doc/;ebin/src/test/LICENSE.txtREADME.mdrebar.config There mi

windows下编译qt的mysql驱动

windows下编译qt的mysql驱动cd %QTDIR%\src\plugins\sqldrivers\mysqlqmake –o Makefile INCLUDEPATH+="C:\MySQL\MySQL5.1\include" LIBS+="C:\MySQL\MySQL5.1\lib\opt\libmysql.lib" mysql.promingw32-make在C :\Qt\2010.05\qt\plugins\sqldrivers就有mysql驱动了my

erlang连接mysql

http://blog.csdn.net/flyinmind/article/details/7740540 项目中用到erlang,同时也用到mysql.惯例,google. 但是,按照网上说的做,有些出入,行不通,需要自己摸索,下面记录我摸索的东西. 1.下载erlang-mysql-driver; 下载地址:https://github.com/dizzyd/erlang-mysql-driver 2.解压到mysql目录,不罗嗦了: 3.编译 要先配置erlang路径,在/etc/pro

erlang连接mysql [转]

转自: http://blog.csdn.net/flyinmind/article/details/7740540 项目中用到erlang,同时也用到mysql.惯例,google. 但是,按照网上说的做,有些出入,行不通,需要自己摸索,下面记录我摸索的东西. 1.下载erlang-mysql-driver; 下载地址:https://github.com/dizzyd/erlang-mysql-driver 2.解压到mysql目录,不罗嗦了: 3.编译 要先配置erlang路径,在/etc

IntelliJ IDEA+Mysql connecter/j JDBC驱动连接

在IntelliJ IDEA中用connecter/j jdbc驱动连接MYSQL 以下是解决过程,待整合...有点懒,有空再改 官方文档:https://www.cnblogs.com/cn-chy-com/p/10145690.html 创建了mysql新用户:https://blog.csdn.net/weixin_38091140/article/details/82983229 配置了JDK:https://blog.csdn.net/Elenal/article/details/53

erlang中字符编码转换(转)

转自:http://www.thinksaas.cn/group/topic/244329/ 功能说明: erlang中对各种语言的编码支持不足,此代码是使用erlang驱动了著名的iconv编码库来对字符进行编码转换处理. 文件说明: iconv_erl.c和iconv.h 是erlang字符编码模块的driver,作用是对iconv进行封装.编译后生成iconv_erl.dll,供iconv.erl使用. iconv_makefile.win32 windows上编译iconv_erl.dl

[flask实践] 解决qq邮箱/mysql的相关配置问题

笔者经过flask web(Miguel著,封面是一条狗)一书的学习,打算实现一个旅游类网站,在此过程中发现,相对于书中的flasky博客程序,需要作出一些改变: 1. 注册邮箱:国内要使用126,qq等邮箱.默认读者了解过flasky邮件的实现方式,而使用126.qq邮箱的不同之处有: 第一,邮箱端口 ['MAIL_PORT'] = 465 不同于gmail的587端口 第二,使用协议 ['MAIL_USE_SSL'] = True 不同于gmail的TLS协议        第三,用户名