Tracing a Memory-leak in a Long Running Eventmachine Application旻琦 潘
Slide: In Huanteng Smart we manufacture smart household gadgets which all connect to a single long running eventmachine application to receive and send instructions with the server. This eventmachine application is a single Linux process holding all TCP connections never closes them. One day, we found that this process was leaking memory, and here is how we managed to trace its cause.
The document provides an overview of Ruby on Rails and its key components. It discusses how Rails is made up of several gems including Rails, ActiveSupport, ActionPack, ActiveRecord, ActiveResource and ActionMailer. It summarizes the purpose and functionality of each gem. For example, it states that ActiveRecord connects classes to database tables for persistence, while ActionPack handles routing, controllers and views.
Tracing a Memory-leak in a Long Running Eventmachine Application旻琦 潘
Slide: In Huanteng Smart we manufacture smart household gadgets which all connect to a single long running eventmachine application to receive and send instructions with the server. This eventmachine application is a single Linux process holding all TCP connections never closes them. One day, we found that this process was leaking memory, and here is how we managed to trace its cause.
The document provides an overview of Ruby on Rails and its key components. It discusses how Rails is made up of several gems including Rails, ActiveSupport, ActionPack, ActiveRecord, ActiveResource and ActionMailer. It summarizes the purpose and functionality of each gem. For example, it states that ActiveRecord connects classes to database tables for persistence, while ActionPack handles routing, controllers and views.
How we scaled git lab for a 30k employee companyMinqi Pan
GitLab, the open source alternative to GitHub written in Rails, does not scale automatically out of the box, as it stores its git repositories on a single filesystem, making storage capabilities hard to expand. Rather than attaching a NAS server, we decided to use a cloud-based object storage (such as S3) to replace the FS. This introduced changes to both the Ruby layer and the deeper C layers. In this talk, we will show the audience how we did the change and overcame the performance loss introduced by network I/O.
This document summarizes activities at a nature center that offers opportunities for physical activity, learning new skills, and experiencing the outdoors. The nature center allows students to connect theoretical knowledge to real-life experiences in the environment. Students participate in various cultural, team-building, cooking, and ecology activities to learn about Norwegian culture and the importance of respecting nature.
The document discusses the history and development of artificial intelligence over the past 70 years. It outlines some of the key milestones in AI research including the creation of logic theories, machine learning algorithms, and neural networks. Recent advances in deep learning now allow AI systems to perform complex tasks like image recognition and natural language processing.
This document lists various features and functions available in a running tracking mobile application, including running a tracking route in the background, taking photos and videos during a run, adding media from the device's camera roll or library, exporting trip data to various platforms like Google Earth, Picasa, Facebook, and Flickr, adding and managing waypoints and notes, viewing trip statistics, and displaying the tracked route and waypoints on maps. The app also allows running the tracker in the background and integrating with contacts.
L’insegnamento è una trasmissione continua di nozioni, informazioni, comunicazioni a cui fa
seguito un apprendimento da parte di un altro interlocutore. Un insegnante efficace è un
insegnante che sa comunicare, ma per poter comunicare è necessario saper ascoltare.
Open Packaging Conventions - Your Data: Accessible, Manageable, and SecureJack Davis
Overview of the ISO 29500-2 and ECMA 376-2 Open Packaging Conventions (OPC) industry standard that serves as the container file technology for numerous Microsoft and third-party file formats. OPC-based file formats include .docx, xlsx, .pptx, .vsix, .appx, and others. For additional information also see http://en.wikipedia.org/wiki/Open_Packaging_Conventions
How we scaled git lab for a 30k employee companyMinqi Pan
GitLab, the open source alternative to GitHub written in Rails, does not scale automatically out of the box, as it stores its git repositories on a single filesystem, making storage capabilities hard to expand. Rather than attaching a NAS server, we decided to use a cloud-based object storage (such as S3) to replace the FS. This introduced changes to both the Ruby layer and the deeper C layers. In this talk, we will show the audience how we did the change and overcame the performance loss introduced by network I/O.
This document summarizes activities at a nature center that offers opportunities for physical activity, learning new skills, and experiencing the outdoors. The nature center allows students to connect theoretical knowledge to real-life experiences in the environment. Students participate in various cultural, team-building, cooking, and ecology activities to learn about Norwegian culture and the importance of respecting nature.
The document discusses the history and development of artificial intelligence over the past 70 years. It outlines some of the key milestones in AI research including the creation of logic theories, machine learning algorithms, and neural networks. Recent advances in deep learning now allow AI systems to perform complex tasks like image recognition and natural language processing.
This document lists various features and functions available in a running tracking mobile application, including running a tracking route in the background, taking photos and videos during a run, adding media from the device's camera roll or library, exporting trip data to various platforms like Google Earth, Picasa, Facebook, and Flickr, adding and managing waypoints and notes, viewing trip statistics, and displaying the tracked route and waypoints on maps. The app also allows running the tracker in the background and integrating with contacts.
L’insegnamento è una trasmissione continua di nozioni, informazioni, comunicazioni a cui fa
seguito un apprendimento da parte di un altro interlocutore. Un insegnante efficace è un
insegnante che sa comunicare, ma per poter comunicare è necessario saper ascoltare.
Open Packaging Conventions - Your Data: Accessible, Manageable, and SecureJack Davis
Overview of the ISO 29500-2 and ECMA 376-2 Open Packaging Conventions (OPC) industry standard that serves as the container file technology for numerous Microsoft and third-party file formats. OPC-based file formats include .docx, xlsx, .pptx, .vsix, .appx, and others. For additional information also see http://en.wikipedia.org/wiki/Open_Packaging_Conventions
在這個資料科學蔚為風潮的年代,身為一個對新技術充滿好奇的攻城獅,自然會想要擴充自己的武器庫,學習嶄新的資料分析工具;而 R 語言,一個由統計學家專門為了資料探索與分析所開發的腳本語言,具有龐大的開源社群支持以及琳瑯滿目、數以萬計的各式套件,正是當今學習資料科學相關工具的首選。
然而,R 語言的設計邏輯與一般的程式語言不同,工程師們過去學習程式語言的經驗,往往造成學習 R 語言的障礙,本課程將從 R 語言的基礎開始,讓同學們從課堂講解以及互動式上機課程中,得以徹底理解 R 語言的核心概念與精要,學習如何利用 R 語言問資料問題,並且從資料分析的角度撰寫效率良好同時具有高度可讀性的 R 語言代碼。
1. L O T U S 让 我 们 写 出 更 S O L I D 的 R U B Y ⼯工 程
P. S . V. R @ [ 北 京 ] [ 2 0 1 4 年 7 ⽉月 1 9 ⽇日 ] R U B Y S A T U R D A Y
H T T P : / / G I T H U B . C O M / P M Q 2 0
2. – N I G H T _ S TA L K E R @ I T E Y E
“上上周在书店看到⼀一本《Ruby设计模式》,捡起
来 10 分钟看完,扔了(别问我为什么……) 下⾯面
⽤用 Ruby 写写设计模式,顺便批⼀一批 Java 和 Gof。”
H T T P : / / G I T H U B . C O M / P M Q 2 0
3. – 佚 名
“Patterns? Interfaces? Are you kidding me? This
isn't Java, it's Ruby! ”
H T T P : / / G I T H U B . C O M / P M Q 2 0
4. R A I L S 的 反 思
• Rails在过去极⼤大降低了web软件开发的⻔门槛,各语⾔言都
陆续⼭山寨了各⾃自的Rails
• 直接向views/models/controllers⽂文件夹⾥里搭积⽊木,没有
编程背景的⼈人也可以快速上⼿手
• 缺乏良好设计的代码会积攒技术债,到项⺫⽬目的后期就开
始出现问题
• ⽤用Rails做出来的项⺫⽬目结构千篇⼀一律,OO设计去哪了?
H T T P : / / G I T H U B . C O M / P M Q 2 0
5. L O T U S 的 设 计 思 想
• 简约——更少的领域特定语⾔言、更少的约定
• 宽容——不强加best-practice、留给开发者发挥空间
• 回归OO——⿎鼓励更多的对象、⾃自由构建对象继承结构
H T T P : / / G I T H U B . C O M / P M Q 2 0
6. L O T U S 的 设 计
遵 循 关 注 点 分 离 原 则 。
H T T P : / / G I T H U B . C O M / P M Q 2 0
7. S E PA R AT I O N O F C O N C E R N S , S O C
• is a design principle for separating a computer
program into distinct sections, such that each section
addresses a separate concern.
• 是处理复杂性的⼀一个原则。由于关注点混杂在⼀一起会导
致复杂性⼤大⼤大增加,所以能够把不同的关注点分离开来,
分别处理就是处理复杂性的⼀一个原则,⼀一种⽅方法。
H T T P : / / G I T H U B . C O M / P M Q 2 0
8. 关 注 点 分 离
• Lotus 由诸多独⽴立的框架构
成
• 模型、控制器、路由、视图、
实⽤用⼯工具、助⼿手
• 每个框架都是⼀一个单独的
gem
• 只要是Rack兼容的应⽤用都
可使⽤用Lotus::Router和
Lotus::Controller
H T T P : / / G I T H U B . C O M / P M Q 2 0
9. L O T U S 各 组 件 的 代 码 ⾏行 数
• Lotus: 1,979 loc
• Lotus::Controller - 2,411 loc
• Lotus::Helper - 12 loc
• Lotus::Model - 3,707 loc
• Lotus::Router - 2,199 loc
• Lotus::Utils - 1,751 loc
• Lotus::View - 2,502 loc
Each library is
designed to be
small, fast and
testable.
H T T P : / / G I T H U B . C O M / P M Q 2 0
11. L O T U S : : R O U T E R 与
R A I L S 路 由 有 什 么 区 别 ?
H T T P : / / G I T H U B . C O M / P M Q 2 0
12. T H E R A I L S R O U T E R
• gem install journey
• Journey is a router. It routes requests.
• journey was merged on Rails 4.0, coupled with
ActionPack code base.
• 路由退居次要⾓角⾊色,隐藏在不透明的⼀一套机制后⾯面
H T T P : / / G I T H U B . C O M / P M Q 2 0
13. L O T U S : : R O U T E R
• an high-level router, not just for a specific framework
• a router for all the Ruby web apps, including Sinatra
and even Rails :) can be used eg. to dispatch HTTP
requests for a pool of Sinatra applications
• 路由是⼀一个简单的对象,其DSL也只不过是在这个对象
上调⽤用公共⽅方法
H T T P : / / G I T H U B . C O M / P M Q 2 0
14. let components to emerge
H T T P : / / G I T H U B . C O M / P M Q 2 0
15. L O T U S : : C O N T R O L L E R 与
A C T I O N _ C O N T R O L L E R 有 什 么 区 别 ?
H T T P : / / G I T H U B . C O M / P M Q 2 0
16. A C T I O N _ C O N T R O L L E R
• action=method
• offers superclasses (eg.ActionController::Base) to be
inherited
• 控制器是⼀一个⼤大类,往往很臃肿
H T T P : / / G I T H U B . C O M / P M Q 2 0
17. L O T U S : : C O N T R O L L E R
• action=class
• offers modules (eg. Lotus::Action) to be included
• action将有更⾼高的内聚性,可防⽌止意外的数据泄漏、系
统的活动部件更少,因此鲁棒性、可靠度、可复⽤用性及
易懂性都能得到提⾼高
H T T P : / / G I T H U B . C O M / P M Q 2 0
19. L O T U S : : M O D E L 与
A C T I V E _ R E C O R D 有 什 么 区 别 ?
H T T P : / / G I T H U B . C O M / P M Q 2 0
20. A C T I V E _ R E C O R D
• 数据持久机制已经写死,必须是关系型数据库
• 往往⼀一个继承⾃自ActiveRecord::Base⼤大类,很臃肿
• ⼀一个模型类知道的太多,职责太多,出现了上帝对象
H T T P : / / G I T H U B . C O M / P M Q 2 0
21. L O T U S : : M O D E L
• 有三类对象:Entities、Data Mapper和Repositories
• 数据持久机制与上层逻辑分离,应⽤用程序依赖API,⽽而
不依赖低层次的细节 (提问:什么OO原则),可以推迟
实现持久层,持久层甚⾄至可以是某第三⽅方REST服务
• Entity实现使⽤用域逻辑、Data Mapper是⼀一个持久性映
射、Repositories结合两者供给查询接⼝口
H T T P : / / G I T H U B . C O M / P M Q 2 0
23. S O L I D : F I V E B A S I C P R I N C I P L E S O F
O B J E C T- O R I E N T E D D E S I G N
• 单⼀一功能
• 开闭原则
• ⾥里⽒氏替换
• 接⼝口隔离
• 依赖反转
H T T P : / / G I T H U B . C O M / P M Q 2 0
24. 因 此 , 使 ⽤用 L O T U S 框 架 促 使
让 我 们 写 出 更 S O L I D 的 R U B Y ⼯工 程 。
H T T P : / / G I T H U B . C O M / P M Q 2 0
25. 欢 迎 关 注
H T T P S : / / G I T H U B . C O M / P M Q 2 0