文章分类 - erlang 技巧
erlang编程的技巧
摘要:在作erlang压力测试的时候 我的机器内存是4G 在erlang程序用到2-3G内存的时候 swapd开始工作了 erlang程序的反应明显慢了下来。但是这时候我实际上还有1G左右的物理内存。起先尝试用swapoff把swap关闭了 系统运行平滑 但是当物理内存用完的时候 我的机器就挂了。这个不是很好。找了资料发现可以解决/proc/sys/vm/swappiness这个问题。 /proc/sys/vm/swappiness默认是50 把它设小linux就不倾向使用swap 反之则用swap. 最后推荐设为10
阅读全文
摘要:http://erlangdisplay.iteye.com/blog/508944
阅读全文
摘要:http://www.linezing.com/blog/?p=347http://www.erlangsir.com/2011/05/27/rebar:erlang构建工具/http://alancastro.org/2010/05/01/erlang-application-management-with-rebar.html
阅读全文
摘要:http://www.iteye.com/topic/326134
阅读全文
摘要:Q: 加入一个新节点到Mnesia System> mnesia:start().> mnesia:change_config(extra_db_nodes, [some_existing_node]). %% disk-less node now> mnesia:change_table_copy_type(schema, node(), disc_copies).> mnesia:create_schema> mneisa:delete_schema> mnesia:add_table_copy> mnesia:del_table_copy1,在分
阅读全文
摘要:assq(Key, List) - case lists:keysearch(Key, 1, List) of {value, {Key, Val}} - {value, Val}; _ - false end. get_option(Key, Options) - case lists:keysearch(Key, 1, Options) of {value, {_Key, Value}} - Value; _ - throw({error, {not_found, Key}}) end.get_option(Key, Options, Default) - case li
阅读全文
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->11>D0=dict:new().2{dict,0,16,16,8,80,48,3{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},4{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}52>D1=dict:store(a,b,D0).6{dict,1,16,16,8,80,48,7
阅读全文
摘要:1.case ets:match_object(evabus_rule, {send_rule, '_','_', '_', '_'}) of[] - [];Datas - Datasend.
阅读全文
摘要:Erlang里数字格式化的问题,常用的取整方法都很简单BIF也很方便,对于保留几位小数的需求,做起来就相当复杂。如果用BIF实现,就是类似如下的代码了float(Format,Number) ->list_to_float(hd(io_lib:format(Format,Number))).在SHELL里执行下是这样的ErlangR14A(erts-5.8) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false]EshellV5.8 (abort with ^G)1> F =fu
阅读全文
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1>Auth=[{domain,"www.baidu.com"},{apikey,"adkfdkf"}].[{domain,"www.baidu.com"},{apikey,"adkfdkf"}]2>proplists:get_value(domain,Auth)."www.baidu.co
阅读全文
浙公网安备 33010602011771号