
erlang
文章平均质量分 63
cfy_yufeng
专注: 高性能,容错, 分布式服务器的研究和实现
信仰: 简单就是美
背景: 14年c开发经验, 12年网络开发经验, 3年Linux内核开发
提供服务器架构、诊断、优化咨询服务
Twitter: eric33yu@
Gmail/Gtalk: mryufeng@
欢迎大家多联系!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
What is the storage capacity of a Mnesia database?
原文地址: http://stackoverflow.com/questions/421501/what-is-the-storage-capacity-of-a-mnesia-databaseQuite large if your question is "whats the storage capacity of anmnesia database made up of a h转载 2009-03-22 17:32:00 · 535 阅读 · 0 评论 -
erlang的dist研究
erlang在dist上花了很多时间 dist.c->global_search->global_group->global->pg->pg2 2w行左右的c代码 上w的erl代码 才让系统在分步上有强壮的基础。erlang这个方面作的很优秀 但是也有一些硬伤 如auth global_group....2007-07-25 00:49:00 · 240 阅读 · 0 评论 -
erlang distributed application
application 的这个特性很好 就是文档里面提到的failover takeover 等 说白了就是application能够自动从失效的节点上迁移到可用的节点,最后再迁移回来。 源码里面的dist_ac为这个特性做的非常复杂。 dist_app + mnesia 就解决了大部分单点故障大的问题了。...2007-07-25 12:51:37 · 130 阅读 · 0 评论 -
减少linux swap对erlang程序的影响
在作erlang压力测试的时候 我的机器内存是4G 在erlang程序用到2-3G内存的时候 swapd开始工作了 erlang程序的反应明显慢了下来。但是这时候我实际上还有1G左右的物理内存。起先尝试用swapoff把swap关闭了 系统运行平滑 但是当物理内存用完的时候 我的机器就挂了。这个不是很好。找了资料发现可以解决/proc/sys/vm/swappiness这个问题。 /proc/sy...2007-07-27 17:06:52 · 138 阅读 · 0 评论 -
erlang的beam模拟器
beam 模拟器有3种 1. beam 默认的2. beam.smp 支持多处理器的3. beam.hybrid 支持混合堆的 我们允许erl的时候 在linux下实际运行的是shell脚本 #!/bin/shROOTDIR=/usr/local/lib/erla...2007-07-27 17:17:09 · 772 阅读 · 0 评论 -
erlang dist protocol 格式
源码的 erts\emulator\internal_doc\erl_ext_dist.txt 描述了erlang ext term的格式, epmd通讯的流程协议和流程 同时还要node 间通讯的协议 相信对理解erlang的分布原理有帮助。...2007-07-31 14:40:00 · 176 阅读 · 0 评论 -
erts运行期内存使用情况查看
翻erlang的代码发现erlang对memory的管理非常重视 内置了多种内存allocator: B: binary_alloc D: std_alloc E: ets_alloc F: fix_alloc H: eheap_alloc L: ll_alloc M: mseg_alloc S: sl...2007-07-31 16:14:49 · 243 阅读 · 0 评论 -
质疑 apache和yaws的性能比较(必看)
http://www.sics.se/~joe/apachevsyaws.html 上比较yaws的性能 显示apache 4000就挂了 但是yaws 8w还在挺着。见附件的图但是你仔细看下他的测试方式What do we measure and how?We use a 16 node cluster running at SICS. We plot throughput vs. pa...2007-07-31 23:24:49 · 211 阅读 · 0 评论 -
erl_call erlang cnode 功能强大
otp_src_R11B-5\lib\erl_interface\src\prog\erl_call.c 是个不错的工具, 就是ei的前端能够通过cnode给erlang的后端发各种请求。具体的见 主题: 如何把erlang应用在项目中? http://www.iteye.com/topic/100425 where: -a apply(Mod,Fun,Args) (e.g -a...2007-08-13 21:35:19 · 330 阅读 · 0 评论 -
erlang inet:setopts 未公开选项
inet:setopt有packet设置选项: {packet, PacketType} (TCP/IP sockets) Defines the type of packets to use for a socket. The following values are valid: raw | 0 No packaging is done. 1 | 2...2007-08-14 13:17:10 · 233 阅读 · 0 评论 -
如何看erts内部的状态
经常在性能优化的时候 要看下erts内部的允许状态 erlang有未公开的函数erts_debug:get_internal_state(XX)XX为atom有以下几个 DECL_AM(node_and_dist_references); DECL_AM(DbTable_words); DECL_AM(next_pid); DECL_AM(next_port...2007-08-15 18:10:16 · 362 阅读 · 0 评论 -
erl CTRL+C do_break 的功能
在erl shell下按下CTRL+C的时候 erts_printf("\n" "BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded\n" " (v)ersion (k)ill (D)b-tables (d)istribution\n");但是实际上可以有更多功能 看代码: while (1) ...2007-08-16 15:43:09 · 271 阅读 · 0 评论 -
方便调试erlang程序的脚本
经常的时候看大型工程的时候 碰到一二个地方实在不明白他是如何运作的 这时候最好的工具就是debugger 如gdb,的backtrace 可以得到完整的函数调用栈。在linux下推荐使用ddd, 俺的centos5 下标准版本没有安装ddd 顺手下载个安装就好了(标准版本却个motif-devel yum下就好)。ddd图形界面方便查看函数和变量,还有点击跳转功能。 附上几个调试erlang的脚本...2007-08-18 15:58:04 · 391 阅读 · 0 评论 -
erlang数据库 ETS 工作原理分析
ETS 是erlang term strorage 的意思 文档见erl5.5.5/lib/stdlib-1.14.5/doc/html/index.html。 这个是beam里面很核心的一个功能。ets, dets, mnesia 组成了erlang的数据库,注意mnesia本身没有存储机制 它的存储就是ets 和dets。用ets:i().看下可以知道11 co...2007-08-18 17:20:00 · 531 阅读 · 0 评论 -
Erlang: 当你net_adm:ping(Node)的时候发生了什么?流程复杂 但是对理解dist工作原理至关重要...
当你net_adm:ping(Node)的时候发生了什么? 这个涉及到很复杂的流程。让我为你解刨:这个流程很长而且在erlang代码和c代码里面窜来窜去,重要的点 我用红字标注 请各位耐心。1. net_adm.erl:ping(Node) when is_atom(Node) -> case catch gen:call({net_kernel, Node}, ...2007-09-05 15:29:46 · 955 阅读 · 0 评论 -
ASN.1协议 适合我们用吗?
R12B发布以后 号称ASN.1解码速度快了好多。前天仔细看了文档,感觉用在自有的系统去不错。ASN.1的结构还是很紧凑的,BER,PER,BER_BIN,PER_BIN都支持。特别是支持选择性decode,这个feature非常赶兴趣。用在自己的项目里面就省去了很多协议编解码的繁琐和易错,毕竟asn compiler也做了几万行 我相信他的性能。...2008-06-16 17:12:48 · 396 阅读 · 0 评论 -
Erlang/OTP R12B-3 released
Erlang/OTP R12B-3 releasedThe third service release for Erlang/OTP R12B has been released. (June 11, 2008) 最大的卖点: An experimental module "re" is added to the emulator which interfaces a pu...2008-06-12 11:30:52 · 177 阅读 · 0 评论 -
gen_tcp 应对对端半关闭
当tcp对端调用shutdown(RD/WR) 时候, 宿主进程默认将收到{tcp_closed, Socket}消息, 如果这个行为不是你想要的,那么请看:shutdown(Socket, How) -> ok | {error, Reason}Types:Socket = socket()How = read | write | read_writeReason...2008-06-13 15:53:25 · 292 阅读 · 0 评论 -
Erlang 进程堆内存增长算法
/* * Heap sizes start growing in a Fibonacci sequence. * * Fib growth is not really ok for really large heaps, for * example is fib(35) == 14meg, whereas fib(36) == 24meg; * ...2007-09-27 18:56:41 · 400 阅读 · 0 评论 -
Erlang Source via Git 终于可以即使获取代码了
Erlang Source via Git 2008-08-01From the erlang-questions mailing list: “I find Matthew Foemmel’s http://github.com/mfoemmel/erlang-otp/tree git repository to be very handy for browsing...原创 2008-08-04 14:38:31 · 178 阅读 · 0 评论 -
erlang中类似netstat的命令
inet:i() 这个函数可以列出网络的连接情况 很实用。(y@erl98.3322.org)46> inet:i().Port Module Recv Sent Owner Local Address Foreign Address State 7 inet_tcp 0 0 <0.20.0> *:13...2007-10-17 13:33:50 · 143 阅读 · 0 评论 -
erlang热部署
erlang的热部署, 相当吸引人,它的release handling 作的非常细, 有核心模块支持(emulator实现), 有工具支持, 支持远程部署, 非常适合工业级别的应用。文档很详细, 感觉应用起来前途很光明。有空专门写个文章分析下原理。...2007-10-17 13:48:40 · 171 阅读 · 0 评论 -
查看erlang内存使用情况
io:format("~s~n", [binary_to_list(erlang:info(info))]).得到结果=memorytotal: 219521173processes: 718806processes_used: 713510system: 218802367atom: 347085atom_used: 338851binary: 13159code: 295...2007-10-17 23:41:17 · 818 阅读 · 0 评论 -
开始规模研究global 和 global_group global_search的原理
The ability to globally register names is a central concept in the programming of distributed Erlang systems.分布式系统 包括流行的p2p系统 要实现的好 必须解决的一个问题是 global名称的问题。 erlang实现的很复杂 erl代码实现了好几千行 折合c语言是好几w行 所以这...2007-10-18 15:47:19 · 249 阅读 · 0 评论 -
erlang远程控制
1. MODULE slave MODULE SUMMARY Functions to Starting and Controlling Slave Nodes2. MODULE pool MODULE SUMMARY Load Distribution Facility3. Erlang ShellEshell V5.5.5 (abort with ^G)1>...2007-10-20 15:51:47 · 184 阅读 · 0 评论 -
erlang sctp支持
erlang kernel 带了个gen_sctp 实现了sctp的 client和server操作, 在linux 2.6 上协议栈支持 lksctp。 网络如果有双线 那么sctp就非常有用 可以起到网络冗余的作用。遗憾的是, R11B5 没有inet_sctp_dist模块 否则erlang的rpc也能走sctp, 那多美呀!sctp可以参考ibm linux china上的文章。...2007-10-22 18:05:39 · 245 阅读 · 0 评论 -
erlang inet_ssl_dist有BUG 导致节点通讯不能用SSL
Erlang R115B 的inet_ssl_dist模块有bug, 我已经定位到问题 提交到 bug mailist, erlang社区的人已经修了这个BUG,并且提交了patch. 有了SSL 通讯更安全些。具体请参看: http://avindev.iteye.com/blog/103310...2007-10-23 09:36:13 · 171 阅读 · 0 评论 -
erlang driver和热部署(重要)
erlang的热部署包括2个方便的 beam(.beam)级别的和driver(.dll .so)级别的. beam级别的就简单。但是driver级别的就相对复杂很多。先看下erl_ddll的说明:Loading and reloading for code replacement This scenario occurs when the driver ...2007-10-23 15:58:24 · 246 阅读 · 0 评论 -
Erlang heart 高可靠性的最后防线
heart由2部份组成:1. 外部程序 heart 2. erlang port模块 heart.erl。当开启heart的时候(erl - heart ...) 外部程序heart被erlang模块heart.erl 启动起来,监视emulator的运作. heart.erl 每隔一定的时间向heart外部程序报告状态。当外部heart没有监测到心跳的时候就要采取行动 重新运行$HE...2007-10-24 14:43:41 · 178 阅读 · 0 评论 -
erlang的erl_crash.dump产生以及如何解读
正常情况下 当erlang进程发生错误没有catch的时候 emulator就会自动产生erl_crash.dump,来提供crash的时候的emulator最详细的情况,类似于unix的core dump. 其中下边几个env变量控制dump产生的行为: ERL_CRASH_DUMP If the emulator needs to write a crash dump, t...2007-10-25 10:06:00 · 5065 阅读 · 1 评论 -
erlang 模拟器工作原理分析
这个是erlang聚会的时候作的一个ppt 简单介绍了emulator的组成和运作原理,凑合着看把,详细的等时间沉淀再写。2007-10-25 10:12:00 · 180 阅读 · 0 评论 -
erlang R12B预览版本出来了
erlang R12B预览版本出来了 可以在 http://erlang.org/download/snapshots/otp_src_R12B-0.tar.gz 下载, 正在比对 看作了什么改进。2007-10-27 10:22:42 · 145 阅读 · 0 评论 -
why-do-you-like-erlang(转)
原文Url: http://www.clickcaster.com/items/why-do-you-like-erlang感觉写的非常好(激动中) 和我的经历几乎一样 得出的结论就是: erlang就是我要的 网络应用erlang足够强大了 After having turned into something of an Erlang zealot about two months a...2007-11-01 18:56:24 · 122 阅读 · 0 评论 -
Joel Reymont号称要出erlang新书教你高级网络应用
注:Joel Reymont openpoker游戏的作者 都是非常高级的话题 涉及到实际项目的设计 编码 调试 部署 维护等话题 覆盖到大部分的otp应用 我们拭目以待。Working title is Hardcore Erlang and it will be built aroundOpenPoker. The emphasis of the book will be mor...2007-11-10 13:52:27 · 168 阅读 · 0 评论 -
erlang r12 新增加Percept并发性能调测模块
Percept is an application-level profiler with focus on parallelism.Can help in finding: – synchronization bottlenecks – periods of few runnable processesMakes use of new trace points in t...2007-11-19 12:10:07 · 128 阅读 · 0 评论 -
R13开始支持binary unicode
[color=red]1 。bitstring语法改动 添加了unicode数据类型[/color]6.16 Bit Syntax Expressions...The types utf8, utf16, and utf32 specifies encoding/decoding of the Unicode Transformation Formats UTF-8, UTF-16...2009-02-27 09:51:09 · 168 阅读 · 0 评论 -
A new Erlang book is on it's way
Concurrent Programming with Erlang/OTP by Martin Logan, Eric Merritt, Richard Carlsson and Robert Calco is now available from Manning Publications Co in an "Early Access Edition". Readers of the E...原创 2009-03-03 09:46:24 · 126 阅读 · 0 评论 -
binary的这个bug R13A还没有修复
Edwin , thanks for your response! :)2008/7/19 Edwin Fine : Litao, I think this is a bug in Erlang R12B-3. Certainly the documentation can be misleading, because in Programming Exampl...2009-03-03 15:43:43 · 138 阅读 · 0 评论 -
erlang shell commands
Shell Commandsb() Prints the current variable bindings.f() Removes all variable bindings.f(X) Removes the binding of variable X.h() Prints the history list.history(N)...2009-03-03 16:19:09 · 123 阅读 · 0 评论 -
erlang节点间connect_all流程
The default when a connection is established between two nodes, is to immediately connect all other visible nodes as well. This way, there is always a fully connected network. If there are nodes with ...2009-03-04 17:33:42 · 364 阅读 · 0 评论