Erlang 池管理:maestro Erlang
                 jopen
                 10年前
            
                    maestro 是 Erlang 池管理程序。
为什么?
短暂 I/O 任务(比如数据库访问)的大型 worker 池会因为太多迁入和迁出活动而拖垮单个 poolboy 管理器。
怎样做?
使用简单的方法,启动多个池;随机迁出。maestro 需要了解每个池的工作流,当每个池都是同一类型的加载模式时,将会提升复杂性,降低性能,没有什么明显的优势。
使用:
MaestroName = many_pools,  Conf = [% maestro options          {name, MaestroName},          {pool_module, poolboy},          {pool_count, 3},          {use_named_pools, false},          % poolboy options          {worker_module, fabulous_worker},          {size, 100},          {max_overflow, 50}],  {ok, _} = maestro:start(Conf),  {SomePool, Worker1} = maestro:checkout(MaestroName),  thing_done = gen_server:call(Worker1, do_your_thing),  ok = maestro:pool_checkin(SomePool, Worker1),  also_done = maestro:transaction(          MaestroName,          fun (Worker) -> gen_server:call(Worker, do_your_other_thing) end),  ok = maestro:stop(MaestroName).