SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
Golang
design4concurrency
v0.0.1 GoMAD Apr 2015
Alea Soluciones
@eferro
@jaimegil
Agenda
Example 1
Example 2
Code samples
References
Conclusion
First, an example
As a customer I put sufficient coins into the vending
machine and then press the selection button for coke and
then press the button to vend and the robotic arm fetches
a coke and dumps it into the pickup tray. The coke is nice
and cold because the cooling system keeps the air in the
vending machine at 50 degrees.
Nouns (potential clases):
Customer, coins, vending machine, selection button, coke,
button to vend, robotic arm, pickup tray, cooling system...
Verbs (methods):
Selection button: push
Vend button: push
Robotic arm: pickup(coke)
cooling system: cool forever
...
OO Solution:
Class, methods
How to implement concurrent behaviours???
OO Solution:
Class, methods
How to implement concurrent behaviours???
Threads, threads pools, locks, debug, debug, debug...
One goroutine for each truly
concurrent activity in the system
Goroutines are not SO processes
Goroutines are not threads
Goroutines are really cheap
One goroutine for each truly concurrent activity in the
system
Handling coins, Putting coins into the slots, Handling selections,
Cooling the soda, Fetching the coke and putting into the pickup tray....
Another example
As a network operator I can check in real time the state of
each home router of our Fiber to the home network
(200,000 routers). The home routers send events with
each state change to the central system.
EventProcessor, DBEventSerializer, RouterStateCalculator,
EventProcessorsPool...
One goroutine for each truly concurrent activity in the
system
Receive events from home routers, Dispatch events, compute state for
a home router...
200,000 routers = min 200,000 goroutines
One goroutine for each truly
concurrent activity in the system
Goroutines are really cheap
Goroutines are really cheap
Goroutines are really cheap
Small mem footprints
Fast creation
Fasts scheduling
Goroutines
Never share memory
Only send messages using channels
Communicate using channels
Code Samples
https://github.com/aleasoluciones/golang_design4concurrency_talk/
Design for concurrency
Don't share memory
Lot of goroutines / they are cheap
Conclusions
References
Go concurrency patterns
https://talks.golang.org/2012/concurrency.slide
Advanced Go concurrency patterns
https://blog.golang.org/advanced-go-concurrency-patterns
@martinjlogan Designing for Actor Based Systems
http://blog.erlware.org/designing-for-actor-based-systems/
Golang patterns for serving on-demand, generated
content
http://blog.gitorious.org/2014/08/11/golang-patterns-for-serving-on-demand-generated-con
tent/
Questions???
@eferro
@jaimegil
Thanks !!!
@eferro
@jaimegil

Weitere ähnliche Inhalte

Was ist angesagt?

Highlights of Go 1.1
Highlights of Go 1.1Highlights of Go 1.1
Highlights of Go 1.1
Cloudflare
 
What make Swift Awesome
What make Swift AwesomeWhat make Swift Awesome
What make Swift Awesome
Sokna Ly
 

Was ist angesagt? (20)

Go on!
Go on!Go on!
Go on!
 
Activate 2019: Tweaking the Base Score: Lucene/Solr Similarities Explained
Activate 2019: Tweaking the Base Score: Lucene/Solr Similarities ExplainedActivate 2019: Tweaking the Base Score: Lucene/Solr Similarities Explained
Activate 2019: Tweaking the Base Score: Lucene/Solr Similarities Explained
 
Tweaking the Base Score: Lucene/Solr Similarities Explained
Tweaking the Base Score: Lucene/Solr Similarities ExplainedTweaking the Base Score: Lucene/Solr Similarities Explained
Tweaking the Base Score: Lucene/Solr Similarities Explained
 
Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
 
Highlights of Go 1.1
Highlights of Go 1.1Highlights of Go 1.1
Highlights of Go 1.1
 
Highlights of Go 1.1
Highlights of Go 1.1Highlights of Go 1.1
Highlights of Go 1.1
 
tokyotalk
tokyotalktokyotalk
tokyotalk
 
What make Swift Awesome
What make Swift AwesomeWhat make Swift Awesome
What make Swift Awesome
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eve
 
Zeromq anatomy & jeromq
Zeromq anatomy & jeromqZeromq anatomy & jeromq
Zeromq anatomy & jeromq
 
Scaling FastAGI Applications with Go
Scaling FastAGI Applications with GoScaling FastAGI Applications with Go
Scaling FastAGI Applications with Go
 
Scapy
ScapyScapy
Scapy
 
ClojureScript - A functional Lisp for the browser
ClojureScript - A functional Lisp for the browserClojureScript - A functional Lisp for the browser
ClojureScript - A functional Lisp for the browser
 
[COSCUP 2018] uTensor C++ Code Generator
[COSCUP 2018] uTensor C++ Code Generator[COSCUP 2018] uTensor C++ Code Generator
[COSCUP 2018] uTensor C++ Code Generator
 
Transmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less painTransmogrifier: Migrating to Plone with less pain
Transmogrifier: Migrating to Plone with less pain
 
Reversing the dropbox client on windows
Reversing the dropbox client on windowsReversing the dropbox client on windows
Reversing the dropbox client on windows
 
Result and screen shots
Result and screen shotsResult and screen shots
Result and screen shots
 
Short introduction to Storm
Short introduction to StormShort introduction to Storm
Short introduction to Storm
 
Laying Pipe with Transmogrifier
Laying Pipe with TransmogrifierLaying Pipe with Transmogrifier
Laying Pipe with Transmogrifier
 
Implementation of 'go-like' language constructions in scala [english version]
Implementation of 'go-like' language constructions in scala [english version] Implementation of 'go-like' language constructions in scala [english version]
Implementation of 'go-like' language constructions in scala [english version]
 

Ähnlich wie Golang design4concurrency

Ähnlich wie Golang design4concurrency (20)

Packer Genetics: The selfish code
Packer Genetics: The selfish codePacker Genetics: The selfish code
Packer Genetics: The selfish code
 
When e-commerce meets Symfony
When e-commerce meets SymfonyWhen e-commerce meets Symfony
When e-commerce meets Symfony
 
KillrChat presentation
KillrChat presentationKillrChat presentation
KillrChat presentation
 
How to Meta-Sumo - Using Logs for Agile Monitoring of Production Services
How to Meta-Sumo - Using Logs for Agile Monitoring of Production ServicesHow to Meta-Sumo - Using Logs for Agile Monitoring of Production Services
How to Meta-Sumo - Using Logs for Agile Monitoring of Production Services
 
Tokens, Complex Systems, and Nature
Tokens, Complex Systems, and NatureTokens, Complex Systems, and Nature
Tokens, Complex Systems, and Nature
 
Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)
 
Unleashing Real-World Simulations: A Python Tutorial by Avjinder Kaler
Unleashing Real-World Simulations: A Python Tutorial by Avjinder KalerUnleashing Real-World Simulations: A Python Tutorial by Avjinder Kaler
Unleashing Real-World Simulations: A Python Tutorial by Avjinder Kaler
 
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil CholewińskiPilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
 
Streaming 101: Hello World
Streaming 101:  Hello WorldStreaming 101:  Hello World
Streaming 101: Hello World
 
EuroSTAR 2018 tutorial Rik Marselis Testing Intelligent Machines
EuroSTAR 2018 tutorial Rik Marselis Testing Intelligent MachinesEuroSTAR 2018 tutorial Rik Marselis Testing Intelligent Machines
EuroSTAR 2018 tutorial Rik Marselis Testing Intelligent Machines
 
Blockchain Development
Blockchain DevelopmentBlockchain Development
Blockchain Development
 
Exploring Boto3 Events With Mitmproxy
Exploring Boto3 Events With MitmproxyExploring Boto3 Events With Mitmproxy
Exploring Boto3 Events With Mitmproxy
 
An OWL Copyright Ontology for Semantic Digital Rights Management
An OWL Copyright Ontology for Semantic Digital Rights ManagementAn OWL Copyright Ontology for Semantic Digital Rights Management
An OWL Copyright Ontology for Semantic Digital Rights Management
 
Grokking Techtalk #38: Escape Analysis in Go compiler
 Grokking Techtalk #38: Escape Analysis in Go compiler Grokking Techtalk #38: Escape Analysis in Go compiler
Grokking Techtalk #38: Escape Analysis in Go compiler
 
Elasticwulf Pycon Talk
Elasticwulf Pycon TalkElasticwulf Pycon Talk
Elasticwulf Pycon Talk
 
Real Time Realitites
Real Time RealititesReal Time Realitites
Real Time Realitites
 
Ruby codebases in an entropic universe
Ruby codebases in an entropic universeRuby codebases in an entropic universe
Ruby codebases in an entropic universe
 
Дмитрий Копляров , Потокобезопасные сигналы в C++
Дмитрий Копляров , Потокобезопасные сигналы в C++Дмитрий Копляров , Потокобезопасные сигналы в C++
Дмитрий Копляров , Потокобезопасные сигналы в C++
 
Sacrificing the golden calf of "coding"
Sacrificing the golden calf of "coding"Sacrificing the golden calf of "coding"
Sacrificing the golden calf of "coding"
 
Ergo Hong Kong meetup
Ergo Hong Kong meetupErgo Hong Kong meetup
Ergo Hong Kong meetup
 

Mehr von Eduardo Ferro Aldama

CAS2016 El Arte del patadon pa'lante / Posponer decisiones
CAS2016 El Arte del patadon pa'lante / Posponer decisionesCAS2016 El Arte del patadon pa'lante / Posponer decisiones
CAS2016 El Arte del patadon pa'lante / Posponer decisiones
Eduardo Ferro Aldama
 

Mehr von Eduardo Ferro Aldama (19)

Product discovery engineering point of view
Product discovery   engineering point of viewProduct discovery   engineering point of view
Product discovery engineering point of view
 
Scalability, basics, application to systems, teams and processes
Scalability, basics, application to systems, teams and processesScalability, basics, application to systems, teams and processes
Scalability, basics, application to systems, teams and processes
 
Agile, en que te hemos convertido v2
Agile, en que te hemos convertido v2Agile, en que te hemos convertido v2
Agile, en que te hemos convertido v2
 
Entrega continua tomandonos la agilidad en serio
Entrega continua   tomandonos la agilidad en serioEntrega continua   tomandonos la agilidad en serio
Entrega continua tomandonos la agilidad en serio
 
Madrid devops forward devops is not what you think
Madrid devops forward devops is not what you thinkMadrid devops forward devops is not what you think
Madrid devops forward devops is not what you think
 
Bilbostack19 devops is not what you think
Bilbostack19 devops is not what you thinkBilbostack19 devops is not what you think
Bilbostack19 devops is not what you think
 
Continuous delivery practices and real experiences
Continuous delivery   practices and real experiencesContinuous delivery   practices and real experiences
Continuous delivery practices and real experiences
 
Cas18 sobreviviendo en producción / Gestión de Incidencias y aprendizajes
Cas18 sobreviviendo en producción / Gestión de Incidencias y aprendizajesCas18 sobreviviendo en producción / Gestión de Incidencias y aprendizajes
Cas18 sobreviviendo en producción / Gestión de Incidencias y aprendizajes
 
CODE ContinuousDelivery. germinando una cultura agile moderna
CODE  ContinuousDelivery. germinando una cultura agile modernaCODE  ContinuousDelivery. germinando una cultura agile moderna
CODE ContinuousDelivery. germinando una cultura agile moderna
 
CAS2017 Agilidad. Hacia la entrega continua ¿Qué te lo impide?
CAS2017 Agilidad. Hacia la entrega continua ¿Qué te lo impide?CAS2017 Agilidad. Hacia la entrega continua ¿Qué te lo impide?
CAS2017 Agilidad. Hacia la entrega continua ¿Qué te lo impide?
 
Acelerando la cultura DevOps mediante Entrega Continua
Acelerando la cultura DevOps mediante Entrega ContinuaAcelerando la cultura DevOps mediante Entrega Continua
Acelerando la cultura DevOps mediante Entrega Continua
 
SCPNA2017 El arte del patadon pa'lante / libro de recetas
SCPNA2017 El arte del patadon pa'lante / libro de recetasSCPNA2017 El arte del patadon pa'lante / libro de recetas
SCPNA2017 El arte del patadon pa'lante / libro de recetas
 
CAS2016 El Arte del patadon pa'lante / Posponer decisiones
CAS2016 El Arte del patadon pa'lante / Posponer decisionesCAS2016 El Arte del patadon pa'lante / Posponer decisiones
CAS2016 El Arte del patadon pa'lante / Posponer decisiones
 
Python Herencia vs Composición (Luke soy tu padre)
Python Herencia vs Composición (Luke soy tu padre)Python Herencia vs Composición (Luke soy tu padre)
Python Herencia vs Composición (Luke soy tu padre)
 
Tdd bdd-practico-dominio-rico
Tdd bdd-practico-dominio-ricoTdd bdd-practico-dominio-rico
Tdd bdd-practico-dominio-rico
 
Python SOLID
Python SOLIDPython SOLID
Python SOLID
 
Mejor framework-pythonoo-solid
Mejor framework-pythonoo-solidMejor framework-pythonoo-solid
Mejor framework-pythonoo-solid
 
Python Madrid empaquetamiento deb aplicaciones Python
Python Madrid empaquetamiento deb aplicaciones PythonPython Madrid empaquetamiento deb aplicaciones Python
Python Madrid empaquetamiento deb aplicaciones Python
 
Madrid devops empaquetamientodeb_i
Madrid devops empaquetamientodeb_iMadrid devops empaquetamientodeb_i
Madrid devops empaquetamientodeb_i
 

Kürzlich hochgeladen

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Kürzlich hochgeladen (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

Golang design4concurrency