zoukankan      html  css  js  c++  java
  • 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。

  • 相关阅读:
    Android网站
    vim里面搜索字符串
    ssd遇到的bug
    ssd训练自己的数据集
    slover层解读
    caffe LOG LOG_IF
    cuda输出
    css中合理的使用nth-child实现布局
    Linux VM环境配置
    怎样对Android设备进行网络抓包
  • 原文地址:https://www.cnblogs.com/getong/p/5161431.html
Copyright © 2011-2022 走看看