SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
#4
Meteor
Asynchronous done right with Meteor
Agenda

intro

problem
solution

outro
My name is
Abderrazak BOUADMA
I’m
Software Engineer (java)
works at
@mbtdoor linkedIn G+
Thanks to
for their support to
Meteor Meetup
intro
Meteor is a platform
built on top of NodeJS
to build

cutting edge fast
web applications.
created to Get Things Done
locked free approach
scalable to the infinity … and beyond
Embraces Simplicity
created to Get Things Done
locked free approach
scalable to the infinity … and beyond
Embraces Simplicity
created to Get Things Done
locked free approach
scalable to the infinity … and beyond
Embraces Simplicity
created to Get Things Done
locked free approach
scalable to the infinity … and beyond
Embraces Simplicity
but ...
still have a long way
to go.
a problem :(
Event Loop

is a programming construct
that waits
for and
dispatches events
or messages in a program
http://blog.mixu.net/2011/02/01/understanding-the-node-js-event-loop/
Synchronous !
process fork
threads
single thread
while(new Date().getTime() < now + 1000) {
// do nothing
}
all I/O is evented and
asynchronous
var fs = require('fs');
fs.readFile( __dirname + '/test.txt', function (err, data)
{
if (err) {
throw err;
}
console.log(data.toString());
});
db.connect()
conn.query
(“select”)

loop

{

conn.execute(“insert”)

conn.execute(“delete”)
callback pyramid of
a solution :)
Fibers
https://github.com/laverdet/node-fibers
allows us to
write asynchronous
code without
callbacks
futures
var fs = require('fs');
fs.readFile( __dirname + '/test.txt', function (err, data)
{
if (err) {
throw err;
}
});
console.log(data.toString());
var fs = require('fs');
fs.readFile( __dirname + '/test.txt', function (err, data)
{
if (err) {
throw err;
}
});
// console.log(data.toString()); won’t run as the ‘data’
// variable is not accessible at this point.
Solution
var fs = require('fs');
var d;
fs.readFile( __dirname + '/test.txt', function (err, data)
{
if (err) {
throw err;
}
d = data;
});
console.log(d.toString());
Resources
http://bjouhier.wordpress.com/2012/03/11/fibers-and-threads-in-node-js-what-for/
http://meteorhacks.com/fibers-eventloop-and-meteor.html
http://blog.mixu.net/2011/02/01/understanding-the-node-js-event-loop/
https://github.com/laverdet/node-fibers
Thanks

Más contenido relacionado

Similar a Meteor and asynchronous done right !

Definitive Guide to Powerful Nodejs Development.pptx
Definitive Guide to Powerful Nodejs Development.pptxDefinitive Guide to Powerful Nodejs Development.pptx
Definitive Guide to Powerful Nodejs Development.pptx75waytechnologies
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleSandeep Hijam
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tourcacois
 
Hands on-intro to Node-RED
Hands on-intro to Node-REDHands on-intro to Node-RED
Hands on-intro to Node-REDPooja Mistry
 
Real timeninja - Codemotion 2015 Roma
Real timeninja - Codemotion 2015 RomaReal timeninja - Codemotion 2015 Roma
Real timeninja - Codemotion 2015 RomaMeanMilan
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN StackNir Noy
 
From hello world to goodbye code
From hello world to goodbye codeFrom hello world to goodbye code
From hello world to goodbye codeKim Moir
 
Wolters Kluwer Tech. Conference: Disrupting Mobile Development
Wolters Kluwer Tech. Conference: Disrupting Mobile DevelopmentWolters Kluwer Tech. Conference: Disrupting Mobile Development
Wolters Kluwer Tech. Conference: Disrupting Mobile DevelopmentMax Katz
 
PHP Cloud Deployment Toolkits
PHP Cloud Deployment ToolkitsPHP Cloud Deployment Toolkits
PHP Cloud Deployment ToolkitsMitch Pirtle
 
Node js presentation
Node js presentationNode js presentation
Node js presentationshereefsakr
 
MAMSys-DISPOSE release version 1.1.1
MAMSys-DISPOSE release version 1.1.1MAMSys-DISPOSE release version 1.1.1
MAMSys-DISPOSE release version 1.1.1Azi Azwady Jamaludin
 
DockerDay2015: Keynote
DockerDay2015: KeynoteDockerDay2015: Keynote
DockerDay2015: KeynoteDocker-Hanoi
 
How My Website Learned to Stop Worrying and Love the Cloud
How My Website Learned to Stop Worrying and Love the CloudHow My Website Learned to Stop Worrying and Love the Cloud
How My Website Learned to Stop Worrying and Love the CloudMike Richwalsky
 
C# classes
C#   classesC#   classes
C# classesTiago
 
Micronaut Framework Guide Framework Basics and Fundamentals.pdf
Micronaut Framework Guide Framework Basics and Fundamentals.pdfMicronaut Framework Guide Framework Basics and Fundamentals.pdf
Micronaut Framework Guide Framework Basics and Fundamentals.pdfInexture Solutions
 
A Shift from Monolith to Microservice using Docker
A Shift from Monolith to Microservice using DockerA Shift from Monolith to Microservice using Docker
A Shift from Monolith to Microservice using DockerAjeet Singh Raina
 

Similar a Meteor and asynchronous done right ! (20)

Definitive Guide to Powerful Nodejs Development.pptx
Definitive Guide to Powerful Nodejs Development.pptxDefinitive Guide to Powerful Nodejs Development.pptx
Definitive Guide to Powerful Nodejs Development.pptx
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning Simple
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
Hands on-intro to Node-RED
Hands on-intro to Node-REDHands on-intro to Node-RED
Hands on-intro to Node-RED
 
Real timeninja - Codemotion 2015 Roma
Real timeninja - Codemotion 2015 RomaReal timeninja - Codemotion 2015 Roma
Real timeninja - Codemotion 2015 Roma
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN Stack
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
From hello world to goodbye code
From hello world to goodbye codeFrom hello world to goodbye code
From hello world to goodbye code
 
Wolters Kluwer Tech. Conference: Disrupting Mobile Development
Wolters Kluwer Tech. Conference: Disrupting Mobile DevelopmentWolters Kluwer Tech. Conference: Disrupting Mobile Development
Wolters Kluwer Tech. Conference: Disrupting Mobile Development
 
TechDayConf Edition 1 - 2020
TechDayConf Edition 1 -  2020TechDayConf Edition 1 -  2020
TechDayConf Edition 1 - 2020
 
PHP Cloud Deployment Toolkits
PHP Cloud Deployment ToolkitsPHP Cloud Deployment Toolkits
PHP Cloud Deployment Toolkits
 
Ob Essay
Ob EssayOb Essay
Ob Essay
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
 
MAMSys-DISPOSE release version 1.1.1
MAMSys-DISPOSE release version 1.1.1MAMSys-DISPOSE release version 1.1.1
MAMSys-DISPOSE release version 1.1.1
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
DockerDay2015: Keynote
DockerDay2015: KeynoteDockerDay2015: Keynote
DockerDay2015: Keynote
 
How My Website Learned to Stop Worrying and Love the Cloud
How My Website Learned to Stop Worrying and Love the CloudHow My Website Learned to Stop Worrying and Love the Cloud
How My Website Learned to Stop Worrying and Love the Cloud
 
C# classes
C#   classesC#   classes
C# classes
 
Micronaut Framework Guide Framework Basics and Fundamentals.pdf
Micronaut Framework Guide Framework Basics and Fundamentals.pdfMicronaut Framework Guide Framework Basics and Fundamentals.pdf
Micronaut Framework Guide Framework Basics and Fundamentals.pdf
 
A Shift from Monolith to Microservice using Docker
A Shift from Monolith to Microservice using DockerA Shift from Monolith to Microservice using Docker
A Shift from Monolith to Microservice using Docker
 

Último

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Último (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Meteor and asynchronous done right !