Submit Search
Upload
如何写出健壮且符合otp设计规范的erlang / elixir程序
•
2 likes
•
654 views
M
Mega Yu
Follow
如何用otp的思维写出健壮高性能的erlang / elixir代码
Read less
Read more
Software
Report
Share
Report
Share
1 of 27
Download now
Download to read offline
Recommended
Administering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud Clusters
Sematext Group, Inc.
Django Celery
Django Celery
Mat Clayton
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015
Jiayun Zhou
Distributed Developer Workflows using Git
Distributed Developer Workflows using Git
Susan Potter
2010 Smith Scripting101
2010 Smith Scripting101
bokonen
Deploying E.L.K stack w Puppet
Deploying E.L.K stack w Puppet
Colin Brown
Scaling up task processing with Celery
Scaling up task processing with Celery
Nicolas Grasset
Introduction to Elixir
Introduction to Elixir
Diacode
Recommended
Administering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud Clusters
Sematext Group, Inc.
Django Celery
Django Celery
Mat Clayton
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015
Jiayun Zhou
Distributed Developer Workflows using Git
Distributed Developer Workflows using Git
Susan Potter
2010 Smith Scripting101
2010 Smith Scripting101
bokonen
Deploying E.L.K stack w Puppet
Deploying E.L.K stack w Puppet
Colin Brown
Scaling up task processing with Celery
Scaling up task processing with Celery
Nicolas Grasset
Introduction to Elixir
Introduction to Elixir
Diacode
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
Brian Schott
Automation and Ansible
Automation and Ansible
jtyr
Ansible presentation
Ansible presentation
John Lynch
Tuning Solr for Logs
Tuning Solr for Logs
Sematext Group, Inc.
Celery with python
Celery with python
Alexandre González Rodríguez
Apache Cassandra and Go
Apache Cassandra and Go
DataStax Academy
Terraform day02
Terraform day02
Gourav Varma
Terraform day03
Terraform day03
Gourav Varma
Custom Non-RDS Multi-AZ Mysql Replication
Custom Non-RDS Multi-AZ Mysql Replication
Michael H. Oshita
Alexander Reelsen - Seccomp for Developers
Alexander Reelsen - Seccomp for Developers
DevDay Dresden
Kotlin 1.2: Sharing code between platforms
Kotlin 1.2: Sharing code between platforms
Kirill Rozov
Ansibleではじめるサーバー・ネットワークの自動化 (Ansible2.7情報つき)2018/10/12
Ansibleではじめるサーバー・ネットワークの自動化 (Ansible2.7情報つき)2018/10/12
akira6592
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environments
ahamilton55
Data processing with celery and rabbit mq
Data processing with celery and rabbit mq
Jeff Peck
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
jimi-c
Small wins in a small time with Apache Solr
Small wins in a small time with Apache Solr
Sourcesense
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
Srijan Technologies
Centralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache Zookeeper
Ryan Gardner
Taking Apache Camel For A Ride
Taking Apache Camel For A Ride
Bruce Snyder
Actor Clustering with Docker Containers and Akka.Net in F#
Actor Clustering with Docker Containers and Akka.Net in F#
Riccardo Terrell
Erlang
Erlang
Aaron Spiegel
Introduction to MongoDB (Webinar Jan 2011)
Introduction to MongoDB (Webinar Jan 2011)
MongoDB
More Related Content
What's hot
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
Brian Schott
Automation and Ansible
Automation and Ansible
jtyr
Ansible presentation
Ansible presentation
John Lynch
Tuning Solr for Logs
Tuning Solr for Logs
Sematext Group, Inc.
Celery with python
Celery with python
Alexandre González Rodríguez
Apache Cassandra and Go
Apache Cassandra and Go
DataStax Academy
Terraform day02
Terraform day02
Gourav Varma
Terraform day03
Terraform day03
Gourav Varma
Custom Non-RDS Multi-AZ Mysql Replication
Custom Non-RDS Multi-AZ Mysql Replication
Michael H. Oshita
Alexander Reelsen - Seccomp for Developers
Alexander Reelsen - Seccomp for Developers
DevDay Dresden
Kotlin 1.2: Sharing code between platforms
Kotlin 1.2: Sharing code between platforms
Kirill Rozov
Ansibleではじめるサーバー・ネットワークの自動化 (Ansible2.7情報つき)2018/10/12
Ansibleではじめるサーバー・ネットワークの自動化 (Ansible2.7情報つき)2018/10/12
akira6592
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environments
ahamilton55
Data processing with celery and rabbit mq
Data processing with celery and rabbit mq
Jeff Peck
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
jimi-c
Small wins in a small time with Apache Solr
Small wins in a small time with Apache Solr
Sourcesense
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
Srijan Technologies
Centralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache Zookeeper
Ryan Gardner
Taking Apache Camel For A Ride
Taking Apache Camel For A Ride
Bruce Snyder
Actor Clustering with Docker Containers and Akka.Net in F#
Actor Clustering with Docker Containers and Akka.Net in F#
Riccardo Terrell
What's hot
(20)
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
Automation and Ansible
Automation and Ansible
Ansible presentation
Ansible presentation
Tuning Solr for Logs
Tuning Solr for Logs
Celery with python
Celery with python
Apache Cassandra and Go
Apache Cassandra and Go
Terraform day02
Terraform day02
Terraform day03
Terraform day03
Custom Non-RDS Multi-AZ Mysql Replication
Custom Non-RDS Multi-AZ Mysql Replication
Alexander Reelsen - Seccomp for Developers
Alexander Reelsen - Seccomp for Developers
Kotlin 1.2: Sharing code between platforms
Kotlin 1.2: Sharing code between platforms
Ansibleではじめるサーバー・ネットワークの自動化 (Ansible2.7情報つき)2018/10/12
Ansibleではじめるサーバー・ネットワークの自動化 (Ansible2.7情報つき)2018/10/12
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environments
Data processing with celery and rabbit mq
Data processing with celery and rabbit mq
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
Small wins in a small time with Apache Solr
Small wins in a small time with Apache Solr
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
Centralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache Zookeeper
Taking Apache Camel For A Ride
Taking Apache Camel For A Ride
Actor Clustering with Docker Containers and Akka.Net in F#
Actor Clustering with Docker Containers and Akka.Net in F#
Viewers also liked
Erlang
Erlang
Aaron Spiegel
Introduction to MongoDB (Webinar Jan 2011)
Introduction to MongoDB (Webinar Jan 2011)
MongoDB
Elixir – Peeking into Elixir's Processes, OTP and Supervisors
Elixir – Peeking into Elixir's Processes, OTP and Supervisors
Benjamin Tan
Concurrency in Elixir with OTP
Concurrency in Elixir with OTP
Justin Reese
Concurrency, Robustness & Elixir SoCraTes 2015
Concurrency, Robustness & Elixir SoCraTes 2015
steffenbauer
How Elixir helped us scale our Video User Profile Service for the Olympics
How Elixir helped us scale our Video User Profile Service for the Olympics
Emerson Macedo
Elixir
Elixir
Marek Kirejczyk
Introduction to MongoDB
Introduction to MongoDB
Ravi Teja
Viewers also liked
(8)
Erlang
Erlang
Introduction to MongoDB (Webinar Jan 2011)
Introduction to MongoDB (Webinar Jan 2011)
Elixir – Peeking into Elixir's Processes, OTP and Supervisors
Elixir – Peeking into Elixir's Processes, OTP and Supervisors
Concurrency in Elixir with OTP
Concurrency in Elixir with OTP
Concurrency, Robustness & Elixir SoCraTes 2015
Concurrency, Robustness & Elixir SoCraTes 2015
How Elixir helped us scale our Video User Profile Service for the Olympics
How Elixir helped us scale our Video User Profile Service for the Olympics
Elixir
Elixir
Introduction to MongoDB
Introduction to MongoDB
Similar to 如何写出健壮且符合otp设计规范的erlang / elixir程序
RabbitMQ
RabbitMQ
voluntas
Erlang Lightning Talk
Erlang Lightning Talk
GiltTech
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
André Graf
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
Taro Matsuzawa
4Developers 2015: Lessons for Erlang VM - Michał Ślaski
4Developers 2015: Lessons for Erlang VM - Michał Ślaski
PROIDEA
Fuzzing - Part 1
Fuzzing - Part 1
UTD Computer Security Group
ECMA5 and ES6 Promises
ECMA5 and ES6 Promises
Oswald Campesato
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
Atsuki Yokota
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661
snyff
Introduction to Apache Kafka
Introduction to Apache Kafka
Shiao-An Yuan
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
goccy
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Skills Matter
Ruby Presentation - Article
Ruby Presentation - Article
Christopher Giroir
Functional programming and ruby in functional style
Functional programming and ruby in functional style
Niranjan Sarade
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis
Moabi.com
Kafka Summit NYC 2017 - Deep Dive Into Apache Kafka
Kafka Summit NYC 2017 - Deep Dive Into Apache Kafka
confluent
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
Sebastian Damm
RubyKaigi 2014: ServerEngine
RubyKaigi 2014: ServerEngine
Treasure Data, Inc.
Ender
Ender
ffffat
Всеволод Струкчинский: Node.js
Всеволод Струкчинский: Node.js
Yandex
Similar to 如何写出健壮且符合otp设计规范的erlang / elixir程序
(20)
RabbitMQ
RabbitMQ
Erlang Lightning Talk
Erlang Lightning Talk
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
4Developers 2015: Lessons for Erlang VM - Michał Ślaski
4Developers 2015: Lessons for Erlang VM - Michał Ślaski
Fuzzing - Part 1
Fuzzing - Part 1
ECMA5 and ES6 Promises
ECMA5 and ES6 Promises
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661
Introduction to Apache Kafka
Introduction to Apache Kafka
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Ruby Presentation - Article
Ruby Presentation - Article
Functional programming and ruby in functional style
Functional programming and ruby in functional style
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis
Kafka Summit NYC 2017 - Deep Dive Into Apache Kafka
Kafka Summit NYC 2017 - Deep Dive Into Apache Kafka
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
RubyKaigi 2014: ServerEngine
RubyKaigi 2014: ServerEngine
Ender
Ender
Всеволод Струкчинский: Node.js
Всеволод Струкчинский: Node.js
Recently uploaded
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
joe51371421
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
kaushalgiri8080
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
Fatema Valibhai
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
Intelisync
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
Evangelist Apps https://twitter.com/EvangelistSW/
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
shikhaohhpro
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
BradBedford3
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
aditisharan08
DNT_Corporate presentation know about us
DNT_Corporate presentation know about us
Dynamic Netsoft
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Ortus Solutions, Corp
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
OnePlan Solutions
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
VICTOR MAESTRE RAMIREZ
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
stazi3110
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Christina Lin
Professional Resume Template for Software Developers
Professional Resume Template for Software Developers
Vinodh Ram
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
Frank van der Linden
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
harshavardhanraghave
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
ICS
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
MyIntelliSource, Inc.
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
OPEN KNOWLEDGE GmbH
Recently uploaded
(20)
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
DNT_Corporate presentation know about us
DNT_Corporate presentation know about us
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Professional Resume Template for Software Developers
Professional Resume Template for Software Developers
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
如何写出健壮且符合otp设计规范的erlang / elixir程序
1.
otp erlang*/*elixir megayu 2015.05.14 1
2.
• erlang • otp erlang
supervisor gen_server ets • beam erlang erlang beam • erts erlang beam kernel • elixir beam 2
3.
erlang func*on 3
4.
func%on module module beam module
func*on func*on module erlang module 1 module elixir module module erlang erlang 1 elixir Kernel elixir Elixir. 1 " erlang system_info 4
5.
Actor erlang actor actor actor actor
actor actor 5
6.
erlang erlang process func-on
process process process process erlang:system_info(process_limit). process 2621442 process process mailbox process process receive 2 " 6
7.
Pid$=$spawn(Mod,$Func,$Args) -export Pid$=$spawn(Fun) Fun Pid$!$Message Message
Pid Pid1!Pid2!...!Msg Msg PidX receive&...&end receive 7
8.
receive 1. a$er 'mer 2.
mailbox mailbox 3. mailbox save2queue 4. receive save2queue 5. save2queue mailbox 'mer 'mer 6. 'mer a$er save2queue mailbox 8
9.
pid pid registered(process 9
10.
process associa)ve+array erlang:get(). erlang:put(a, 1). erlang:get(a). erlang:put(b,
1). erlang:get(b). erlang:put(b, erlang:get(b) + 1). erlang:get(). erlang:erase(b). erlang:get(). erlang:erase(). erlang:get(). 10
11.
erlang 11
12.
catch exit(normal) catch exit(Reason) Reason normal
atom 12
13.
signal signal normal'exit signal abnormal(exit signal 13
14.
process_flag(trap_exit, true). signal signal {'EXIT',
Pid, Reason} mailbox 14
15.
{'DOWN',Ref,process,Pid,Why} 15
16.
exit(Pid, Reason) Pid Reason
exit,signal Pid normal kill {'EXIT', From, Reason} From pid normal {'EXIT', From, normal} kill exit'signal Pid killed 16
17.
catch Expression exit(Reason) catch exit(Pid,
Reason) catch throw catch catch 17
18.
erlang • link monitor • 18
19.
gen_server Client'Server Server callback Server gen_server
module Callback module ----------------- --------------- gen_server:start_link -----> Module:init/1 gen_server:call -----> Module:handle_call/3 gen_server:cast -----> Module:handle_cast/2 other message -----> Module:handle_info/2 exit -----> Module:terminate/2 Dynamic Code Upgrade -----> Module:code_change/3 19
20.
supervisor supervisor worker worker gen_server
gen_fsm gen_event supervisor init ChildSpecs = [child_spec()] child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} Id = term() StartFunc = {M,F,A} M = F = atom() A = [term()] Restart = permanent | transient | temporary Shutdown = brutal_kill | int()>0 | infinity Type = worker | supervisor Modules = [Module] | dynamic Module = atom() 20
21.
• one_for_one • one_for_all
1 • rest_for_one • simple_one_for_one one_for_one 21
22.
applica&on start supervisor erlang appname.app.src
elixir mix.exs start 22
23.
otp 1. applica(on 2. 3. supervisor
server 4. 5. 6. 7. 8. 9. 10. 11. 23
24.
1. catch gen_server:call 2. 3. 4. 5. 6.
ETS 7. 8. 24
25.
observer shell observer:start(). observer applica&on
applica&on ETS 25
26.
erlang • • erlang ETS DETS
large,binaries off2heap,storage,area ETS public • I/O distributed,algorithm distributed,hash,tables • CPU, Core • mapreduce cpu2bound erlang 26
27.
Q"&"A Thanks 27
Download now