ITeye博客

erlang非业余研究

mryufeng · 共 282 篇文章

[置顶] 研究Erlang 4000小时以后

历经2年半,花了4000小时以后,对erlang的研究有了很大的进步,从原来的兴趣, 到现在的随意的crack, 调优,改进, 指导erlang程序架构的设计,中间经历了很多。 从一个有20年历史的网络程序身上我学到很多,包括高级服务器程序的架构,调度公平性,网络事件处理, 内存管理, 锁管理, SMP管理, 平台移植, 虚拟机,语言的基本构件,用户交互,调试, 诊断, 调优,工具。 也学会了使用OS提供的工具如systemtap, oprofile,内存, CPU工具来诊断,来定位问题,这个可以参考rhel的调优白皮书。 这个成熟系统带来的经验感受如同你窥视一台精密设计的机器,一环套着一环…

2009-08-25 23:19 · erlang · 评论(21)

我已搬迁到blog.yufeng.info

http://mryufeng.iteye.com 这里已停止更新,谢谢javaeye的优质服务。 以后会在独立的域名 http://yufeng.info 下更新博客, 同时内容也会从Erlang扩展到Linux, 工具,以及编程技术等方面, 谢谢大家的关注。 请朋友们更新书签。 余锋 2011/1/9

2011-01-09 15:38 · 评论(0)

OTP R14A今天发布了

以下是这次发布的亮点,没有太大的性能改进, 主要是修理了很多BUG! --- HIGHLIGHTS ---------------------------------------------------------- OTP-8217 == erts stdlib compiler == The module binary from EEP31 (and EEP9) is implemented. OTP-8485 == common_test == It is now possible for the user to provide specific callback modules th…

2010-06-17 14:36 · erlang · 评论(3)

R14A实现了EEP31,添加了binary模块

Erlang的binary数据结构非常强大,而且偏向底层,在作网络程序的时候,很方便的能够和二进制协议对应起来。但是由于这个数据结构加入erlang语言的时间不是很长,相关的配套模块不是很多。 在binary的匹配,替换,修改就显的非常麻烦。 于是有了EEP31 。 R14A昨天已经实现了这个功能, 在stdlib下添加了个binary模块。 这个模块大部分功能是由BIF实现的,同时充分考虑了CPU使用的公平性,源码大部分在erl_bif_binary.c下。 还添加了个gurad函数: binary_part进一步方便我们写匹配条件。 我们在源码里面发现了以下注释: /* The nati…

2010-05-21 15:15 · erlang · 评论(2)

如何查看节点的可用句柄数目和已用句柄数

很多同学在使用erlang的过程中, 碰到了很奇怪的问题, 后来查明都是文件句柄不够用了, 因为系统默认的是每个进程1024. 所以我们有必要在程序运行的时候, 了解这些信息, 以便诊断和预警. 下面的这个程序就演示了这个如何查看节点的可用句柄数目和已用句柄数的功能. 首先确保你已经安装了lsof, 我的系统是ubuntu可以这样安装. root@ubuntu:~# apt-get -y install lsof root@ubuntu:~# cat fd.erl -module(fd). -export([start/0]). get_total_fd_ulimit() -> {MaxFd…

2010-04-08 03:31 · erlang · 评论(1)

获取Erlang系统信息的代码片段

从lib/megaco/src/tcp/megaco_tcp_connection.erl摘抄的代码, 挺详细的关于系统的信息: SchedId = erlang:system_info(scheduler_id), SchedNum = erlang:system_info(schedulers), ProcCount = erlang:system_info(process_count), ProcLimit = erlang:system_info(process_limit), ProcMemUsed = erlang:memory(processes_used), ProcMemA…

2010-04-06 21:49 · erlang · 评论(0)

iolist跟list有什么区别?

看到erlang-china.org上有个帖子在问这个问题 一直不太明白iolist,跟list到底有什么区别?请各位大侠指教。。 我翻看了半天erlang的文档也没写的太明白,所以就看看源码: erts/emulator/beam/utils.c 3015int io_list_len(Eterm obj) 3016{ 3017 Eterm* objp; 3018 Sint len = 0; 3019 DECLARE_ESTACK(s); 3020 goto L_again; 3021 3022 while (!ESTACK_ISEMPTY(s)) { 3023 obj = ESTACK_…

2010-04-06 20:30 · erlang · 评论(0)

erlang:send_after和erlang:start_timer的使用解释

前段时间arksea 同学提出这个问题, 因为文档里面写的很不明白. erlang:send_after(Time, Dest, Msg) -> TimerRef Time = int() 0 <= Time <= 4294967295 Dest = pid() | RegName LocalPid = pid() (of a process, alive or dead, on the local node) Msg = term() TimerRef = ref() Starts a timer which will send the message Msg to Dest after …

2010-04-06 18:31 · erlang · 评论(0)

Latest news from the Erlang/OTP team at Ericsson 2010

参考Talk http://www.erlang-factory.com/upload/presentations/238/ErlangFView postactorySFBay2010-KennethLundin.pdf 摘抄我感兴趣的: R14要实现的: June 16: R14A, a beta release Multi-core performance improvements – optimized rwlocks – delayed deallocation – ”lock-free” process table NIF improvements (Native Impleme…

2010-04-05 19:23 · erlang · 评论(0)

对try 异常 运行的疑问,为什么出现两种结果

郎咸武 langxianzhe@163.com 同学在erlang-china上post了一个问题: 请注意编号为91和92两行运行结果,请问为什么会出现两种结果。 一个抛出 {error,{badmatch,5}} 另一个抛出** exception error: no match of right hand side value 4 view source print? 01 root@ubuntu:/usr/src/otp# erl 02 Erlang R13B04 (erts-5.7.5) }} 17 95> try (X=4) of Val ->{normal,Val} catch…

2010-04-05 19:22 · erlang · 评论(0)

Erlang ERTS Async基础设施

其实Erts的Async做的很不错的, 相当的完备, 性能又高. 但是奇怪的是只有文件driver才真正利用到了这个优势. 难道是OTP团队的人,不想为了性能把事情搞的复杂了. Driver和最近加入的NIF都提供了大量的线程,锁,同步的原语来支持最大的程度的利用单线程的优势. 俺会做小白鼠来参试这些被遗忘的设施.

2010-03-19 00:03 · erlang · 评论(1)

Haproxy 1.4-dev2: barrier of 100k HTTP req/s crossed

原文地址: http://haproxy.1wt.eu/10g.html 点滴优化造就了今天的性能, willy好样的,应该是目前软件做到的最好的数字 Introduction It was my first test since I moved house. I wanted to quickly plug the machines together to see if my work on version 1.4 went into the right direction, and most importantly was not causing performance drops. V…

2010-03-09 23:00 · 网络 · 评论(9)

CloudI 0.0.9 Released, A Cloud as an Interface

基于Erlang的云平台 看了下代码 质量还是不错的 完成了不少, 兴趣的同学可以参观下 CloudI 0.0.9 (alpha) Homepage: http://cloudi.org Download: http://sourceforge.net/projects/cloudi/files/0.0.9a/cloudi-0.0.9.tar.gz/download Source: http://github.com/okeuday/CloudI/tree/master#readme ABOUT CloudI is an open-source private cloud computing…

2010-03-09 22:32 · erlang · 评论(1)

Memory matters - even in Erlang (再次说明了了解内存如何工作的必要性)

原文地址: http://www.lshift.net/blog/2010/02/28/memory-matters-even-in-erlang 作者解决问题的思路非常敬佩! 真没想到hibernation后, 由于对象的移动, 使得内存访问的不连续, 导致内存cahche的失效, 速度可以慢这么多! Some time ago we got an interesting bug report for RabbitMQ. Surprisingly, unlike other complex bugs, this one is easy to describe: At some point …

2010-03-09 20:26 · erlang · 评论(5)

Some simple examples of using Erlang’s XPath implementation

原文地址 http://www.lshift.net/blog/2008/01/31/some-simple-examples-of-using-erlangs-xpath-implementation We’ve been investigating the possibility of an XPath-based routing extension to RabbitMQ, where XPath would be used as binding patterns, and the message structure would be exposed as XML infoset. A…

2010-03-08 23:30 · erlang · 评论(3)