Erlang进程池 Worker Pool

码农软件 · 软件分类 · 常用工具包 · 2019-08-14 22:43:45

软件介绍

Worker Pool 是一个Erlang进程池,其中的工作进程是Erlang的gen server模式进程。

Worker Pool的目标是非常简单: 提供以透明的方式管理一批工作进程并且对分配到池中的任务尽最大努力实现负载均衡。

一个 Echo 服务器示例:

-module(echo_server).
-author('elbrujohalcon@inaka.net').

-behaviour(gen_server).

%% gen_server callbacks
-export([init/1, terminate/2, code_change/3,
         handle_call/3, handle_cast/2, handle_info/2]).

-dialyzer([no_behaviours]).

%%%===================================================================
%%% callbacks
%%%===================================================================
-spec init(Something) -> Something.
init(Something) -> Something.

-spec terminate(Any, term()) -> Any.
terminate(Reason, _State) -> Reason.

-spec code_change(string(), State, any()) -> {ok, State}.
code_change(_OldVsn, State, _Extra) -> {ok, State}.

-spec handle_info(timeout | Info, term()) -> {noreply, timeout} | Info.
handle_info(timeout, _State) -> {noreply, timeout};
handle_info(Info, _State) -> Info.

-spec handle_cast(Cast, term()) -> Cast.
handle_cast(Cast, _State) -> Cast.

-type from() :: {pid(), reference()}.
-spec handle_call(state | Call, from(), State) -> {reply, State, State} | Call.
handle_call(state, _From, State) -> {reply, State, State};
handle_call(Call, _From, _State) -> Call.

本文地址:https://codercto.com/soft/d/12383.html

超预期

超预期

[美] 莱昂纳多·因基莱里、迈卡·所罗门 / 杨波 / 后浪丨江西人民出版社 / 2017-11 / 45.00元

用户体验决定产品成败,只有超预期才能赢得好口碑! 互联网大佬一致推崇的打造爆款产品及服务的核心理念 ................... ※编辑推荐※ ☆ 超预期,才有用户体验,互联网大佬一致推崇的打造爆款产品及服务的核心理念 - 周鸿祎:“什么叫用户体验?超过用户预期才叫 体验!” - 雷军:“口碑的真谛是超越用户的期望值。” - 马化腾:“用户体验,......一起来看看 《超预期》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试