• 1. Erlang及其应用余锋 2009/03/11 http://blog.yufeng.info
  • 2. What is ErlangErlang is a general-purpose programming language and runtime environment. Erlang has built-in support for concurrency, distribution and fault tolerance. Erlang is used in several large telecommunication systems from Ericsson.
  • 3. What sort of applications is Erlang particularly suitable forDistributed, reliable, soft real concurrent systems. Telecommunication systems, e.g. controlling a switch or converting protocols. Servers for Internet applications, e.g. a mail transfer agent, an IMAP-4 server, an HTTP server or a wap stack Telecommunication applications, e.g. handling mobility in a mobile network or providing unified messaging. Database applications which require soft realtime behaviour. Erlang is good at solving these sorts of problems because this is the problem domain it was originally designed for. Stating the above in terms of features: Erlang provides a simple and powerful model for error containment and fault tolerance (supervised processes).
  • 4. 续上页Concurrency and message passing are a fundamental to the language. Applications written in Erlang are often composed of hundreds or thousands of lightweight processes. Context switching between Erlang processes is typically one or two orders of magnitude cheaper than switching between threads in a C program. Writing applications which are made of parts which execute on different machines (i.e. distributed applications) is easy. Erlang's distribution mechanisms are transparent: programs need not be aware that they are distributed. The OTP libraries provide support for many common problems in networking and telecommunications systems. The Erlang runtime environment (a virtual machine, much like the Java virtual machine) means that code compiled on one architecture runs anywhere. The runtime system also allows code in a running system to be updated without interrupting the program.
  • 5. What is OTP?OTP (Open Telecom Platform) is a large collection of libraries for Erlang to do everything from compiling ASN.1 to providing a WWW server. Most projects using "Erlang" are actually using "Erlang/OTP", i.e. the language and the libraries. OTP is also open source.
  • 6. Erlang的优势高性能 多核心SMP的支持 透明分布的支持 完善的监控信息 商业产品上经过时间的验证成熟 轻量进程的支持
  • 7. 为什么其他语言要移植到Erlang虚拟机语言Reia会成功吗 作者看中什么? 框架 概念 成熟度 性能 模型
  • 8. Erlang语言特性简单小巧 模式匹配 变量单次赋值 丰富的库 灵活多样的错误处理 代码热替换 天生的分布式 多核支持
  • 9. Erlang的代码规模200K行C代码 几千行Erlang代码 同等的ACE框架 代码成熟度 尺寸很小 适合于嵌入式 1.5M 也适合做桌面程序 如p2p
  • 10. Erlang ERTS是个典型的网络服务器框架IO处理 kernel poll 如epoll kqueue 定时器处理 timewheel 逻辑处理处理 process coroutine fiber smp
  • 11. 纯消息驱动的系统多核心处理消息 调度器平衡迁移 同步和异步 无锁编程
  • 12. 多处理器利用技术线程 调度器 异步线程 driver发起的线程 精巧的锁 process_lock 快速的mutex 进程 PORT 管道通讯
  • 13. 强大的PORT仿照Unix的哲学: 一切都是文件 管道通讯类似CGI 对外世界的重要通道 整合其他语言写的模块
  • 14. 与其他系统整合C节点(EI) Java (jinterface) Cobra TCP/HTTP
  • 15. RPC内置的RPC 自动维护节点的up down 知道节点名称就可以通讯 轻松分拆服务
  • 16. 热部署功能不停机维护 在线升级 系统同时跑新旧代码 发现问题在线降级 工具化 一切自动化
  • 17. 监控功能OS mon SNMP HTTP
  • 18. 代码安全代码可远程从网络加载 Diskless 代码可加密 强加密防止反编译 开源协议
  • 19. 远程维护强大的内置shell ssh sftp 日志系统
  • 20. 平台移植Windows (smp支持的不好) *nix 关键语义屏蔽平台变化
  • 21. 和其他网络库的比较Erlang 相对于 ACE 完整的平台 工具 开发工具 调优工具 排错工具 跟踪工具
  • 22. 应用障碍FP语言 独特的哲学 社区小 库偏少
  • 23. 应用案例Facebook 盛大 金山 校内 很多小startup公司
  • 24. Q&A谢谢大家