SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
REAL-TIME WEB
Medhat Dawoud
www.medhatdawoud.net
@Med7atDawoud
What is Real-time web
• The meaning is that: users can see the contents
as fast as the author publish it (like chat
applications)
• A lot of technologies are used to implement the
Real-time systems.
• Today I’m interested in a technology that do that
for us in an easy, reliable, and fantastic way
To create Real-time system on web we need ..
• Very fast web server.
• Very very fast I/O operations (Non-blocking).
• System that depend on event-driven(event-loops).
• Flexible tool to handle all of this in a simple way.
Some technologies for Real-time systems
Python [ twisted ]
Ruby [ EventMachine ]
Perl [ AnyEvent ]
If you deal with one of them, this presentation will be really understood at once.
Finally , The Magic Technology Appears
• 2009 - this guy “Ryan Dahl” releases something
that support the highly-performance
concurrent applications.
• It’s called Node.js
What is Node.js ?
• In simple words Node.js is ‘server-side JavaScript’.
• In not-so-simple words Node.js is a high-performance
network applications framework, well optimized for high
concurrent environments.
• It’s Open Source. It runs well on Linux systems, can
also run on Windows systems.
• uses an asynchronous event-driven model.
What is Node.js ?
• Built and run on V8 JavaScript engine.
• In ‘Node.js’ , ‘.js’ doesn’t mean that its solely written
JavaScript. It is 40% JS and 60% C++.
• is now the most followed project on Github,
exceeding Ruby on Rails .. woooooo
• From the official site:
‘Node's goal is to provide an easy way to build scalable
network programs’ - (from nodejs.org!)
Google V8 engine
• V8 is an open source JavaScript engine
developed by Google. It’s written in C++ and is
used in Google Chrome Browser.
• Faster than SpiderMonkey (used in firefox) over
4 times ( when V8 was invented ) 
- from an expert on stakoverflow -
Theory 1 : Event-loops
Event-loops are the core of event-driven programming, almost
all the UI programs use event-loops to track the user event, for
example: Clicks, Ajax Requests etc.
Client
Event loop
(main thread)
C++ Threadpool
(worker threads)
Clients send HTTP requests
to Node.js server
An Event-loop is woken up by OS,
passes request and response objects
to the thread-pool
Long-running jobs run
on worker threads
Response is sent
back to main thread
via callback
Event loop returns
result to client
Theory 2 : Non-blocking I/O
• Traditional I/O
var result = db.query(“select x from table_Y”);
doSomethingWith(result); //wait for result!
doSomethingWithOutResult(); //execution is blocked!
• Non-traditional, Non-blocking I/O
db.query(“select x from table_Y”,function (result){
doSomethingWith(result); //wait for result!
});
doSomethingWithOutResult(); //executes without any delay!
Natural & Features of Node.js ( some confusing )
• Apply it in the coolest, sexiest, most popular
language on the planet.
• Node.js uses an event-driven, non-blocking I/O
model, which makes it lightweight.
• The big support of V8 from Google is a great power.
Why JavaScript was suitable for that ?
• JavaScript Callbacks feature that solve the problem of
event-loops.
• The great NPM (Node Package Manager).
• Node.js JavaScript quite different : there is no DOM
implementation provided by Node.js,
• i.e. you can not do this:
var element = document.getElementById(“elementId”);
• Everything inside Node.js runs in a single-thread.
Natural & Features of Node.js ( some confusing )
What can we do with Node.js
• You can create an HTTP server and print ‘hello world’
on the browser in just 4 lines of JavaScript.
• You can create a DNS server.
• You can create a Web Chat Application like GTalk in the
browser.
• Node.js can also be used for creating online games,
collaboration tools or anything which sends updates to
the user in Real-time.
Example: Creating Http server
When to use Node.js ?
• streaming based Real-time services, online
games, web chat applications,..etc.
• If you need high level concurrency and not
worried about CPU-cycles.
• If you are good at JavaScript code.
• You will develop the front-end and back-end in the same
language, what a triumph 
Some Benchmarks (proof of power)
Taken from:
http://code.google.com/p/node-js-vs-apache-
php-benchmark/wiki/Tests
A benchmark between Apache+PHP
and node.js, shows the response time
for 1000 concurrent connections
making 10,000 requests each, for 5
tests.
Some Benchmarks (proof of power)
Taken from:
http://nodejs.org/jsconf2010.pdf
The benchmark shows the
response time in milli-secs for 4
evented servers.
Who is using Node.js
Complete list can be found at: https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node
Some Modules you will love them
• Express– to make things simpler e.g. syntax, DB connections.
• Jade – HTML template system
• Socket.IO– to create real-time apps
• CoffeeScript – for easier JavaScript development
Find out more about some widely used Node.js modules at:
http://blog.nodejitsu.com/top-node-module-creators
The last thing to say (How to start ?!)
• Try to explore the rest of Node.js your self.
• I recommend a free book to start called
• ( O’raily Book : Up and Running With Node.js)
• Tutorial sites:
• Nodejs.org
• Letsnode.com
• Google.com
• The series of articles in arabic isA on ( medhatdawoud.net)
Medhat Dawoud
www.medhatdawoud.net
Twitter: @Med7atdawoud
Thanks

Contenu connexe

Tendances

How we use Bitbucket to build Bitbucket
How we use Bitbucket to build BitbucketHow we use Bitbucket to build Bitbucket
How we use Bitbucket to build BitbucketShunsuke (Sean) Osawa
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development WorkflowVũ Nguyễn
 
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana MandziukFwdays
 
Microservices in Golang
Microservices in GolangMicroservices in Golang
Microservices in GolangMo'ath Qasim
 
Difference between gitlab vs github vs bitbucket
Difference between gitlab vs github vs bitbucketDifference between gitlab vs github vs bitbucket
Difference between gitlab vs github vs bitbucketAcodez IT Solutions
 
Blazor, lo sapevi che...
Blazor, lo sapevi che...Blazor, lo sapevi che...
Blazor, lo sapevi che...Andrea Dottor
 
Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010sullis
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingAugusto Lazaro
 
The New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by PythonThe New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by PythonAll Things Open
 
Using the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to BitbucketUsing the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to BitbucketLiam Dempsey
 
Webkit Chromium Contribution Process
Webkit Chromium Contribution ProcessWebkit Chromium Contribution Process
Webkit Chromium Contribution ProcessGyuyoung Kim
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productiveKarsten Dambekalns
 
Intro to meteor @py gotham Aug 15-16 2015
Intro to meteor @py gotham Aug 15-16 2015Intro to meteor @py gotham Aug 15-16 2015
Intro to meteor @py gotham Aug 15-16 2015christieewen
 

Tendances (20)

How we use Bitbucket to build Bitbucket
How we use Bitbucket to build BitbucketHow we use Bitbucket to build Bitbucket
How we use Bitbucket to build Bitbucket
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
 
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
 
Microservices in Golang
Microservices in GolangMicroservices in Golang
Microservices in Golang
 
Gradle : An introduction
Gradle : An introduction Gradle : An introduction
Gradle : An introduction
 
Difference between gitlab vs github vs bitbucket
Difference between gitlab vs github vs bitbucketDifference between gitlab vs github vs bitbucket
Difference between gitlab vs github vs bitbucket
 
Github PowerPoint Final
Github PowerPoint FinalGithub PowerPoint Final
Github PowerPoint Final
 
Nodejs
NodejsNodejs
Nodejs
 
Blazor, lo sapevi che...
Blazor, lo sapevi che...Blazor, lo sapevi che...
Blazor, lo sapevi che...
 
Firebase Code Lab - 2015 GDG Buffalo DevFest
Firebase Code Lab - 2015 GDG Buffalo DevFestFirebase Code Lab - 2015 GDG Buffalo DevFest
Firebase Code Lab - 2015 GDG Buffalo DevFest
 
Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React Testing
 
The New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by PythonThe New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by Python
 
Node js
Node jsNode js
Node js
 
Using the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to BitbucketUsing the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to Bitbucket
 
React Faceoff at Philly.NET
React Faceoff at Philly.NETReact Faceoff at Philly.NET
React Faceoff at Philly.NET
 
Webkit Chromium Contribution Process
Webkit Chromium Contribution ProcessWebkit Chromium Contribution Process
Webkit Chromium Contribution Process
 
Git
GitGit
Git
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 
Intro to meteor @py gotham Aug 15-16 2015
Intro to meteor @py gotham Aug 15-16 2015Intro to meteor @py gotham Aug 15-16 2015
Intro to meteor @py gotham Aug 15-16 2015
 

En vedette (9)

Thread
ThreadThread
Thread
 
Threading
ThreadingThreading
Threading
 
Multi threading design pattern
Multi threading design patternMulti threading design pattern
Multi threading design pattern
 
multi threading
multi threadingmulti threading
multi threading
 
Threads c sharp
Threads c sharpThreads c sharp
Threads c sharp
 
C# Advanced L04-Threading
C# Advanced L04-ThreadingC# Advanced L04-Threading
C# Advanced L04-Threading
 
Threading in C#
Threading in C#Threading in C#
Threading in C#
 
Threads c sharp
Threads c sharpThreads c sharp
Threads c sharp
 
Threading in c#
Threading in c#Threading in c#
Threading in c#
 

Similaire à Real time web

Similaire à Real time web (20)

Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node.js for beginner
Node.js for beginnerNode.js for beginner
Node.js for beginner
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Proposal
ProposalProposal
Proposal
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
 
Nodejs
NodejsNodejs
Nodejs
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
Node
NodeNode
Node
 
Node js internal
Node js internalNode js internal
Node js internal
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
Tech Thursdays: Building Products
Tech Thursdays: Building ProductsTech Thursdays: Building Products
Tech Thursdays: Building Products
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
 
Node
NodeNode
Node
 

Plus de Medhat Dawoud

Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucketMedhat Dawoud
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linuxMedhat Dawoud
 
Intro to t sql – 3rd session
Intro to t sql – 3rd sessionIntro to t sql – 3rd session
Intro to t sql – 3rd sessionMedhat Dawoud
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st sessionMedhat Dawoud
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionMedhat Dawoud
 
Mesh cloud (road to mongoDB)
Mesh cloud (road to mongoDB)Mesh cloud (road to mongoDB)
Mesh cloud (road to mongoDB)Medhat Dawoud
 

Plus de Medhat Dawoud (12)

Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Select your career
Select your careerSelect your career
Select your career
 
Intro to t sql – 3rd session
Intro to t sql – 3rd sessionIntro to t sql – 3rd session
Intro to t sql – 3rd session
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st session
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
 
Mesh cloud (road to mongoDB)
Mesh cloud (road to mongoDB)Mesh cloud (road to mongoDB)
Mesh cloud (road to mongoDB)
 
Before start
Before startBefore start
Before start
 
DevMix Startup
DevMix StartupDevMix Startup
DevMix Startup
 
How to python
How to pythonHow to python
How to python
 
Program threats
Program threatsProgram threats
Program threats
 
Unusual C# - OOP
Unusual C# - OOPUnusual C# - OOP
Unusual C# - OOP
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Dernier (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Real time web

  • 2.
  • 3. What is Real-time web • The meaning is that: users can see the contents as fast as the author publish it (like chat applications) • A lot of technologies are used to implement the Real-time systems. • Today I’m interested in a technology that do that for us in an easy, reliable, and fantastic way
  • 4. To create Real-time system on web we need .. • Very fast web server. • Very very fast I/O operations (Non-blocking). • System that depend on event-driven(event-loops). • Flexible tool to handle all of this in a simple way.
  • 5. Some technologies for Real-time systems Python [ twisted ] Ruby [ EventMachine ] Perl [ AnyEvent ] If you deal with one of them, this presentation will be really understood at once.
  • 6. Finally , The Magic Technology Appears • 2009 - this guy “Ryan Dahl” releases something that support the highly-performance concurrent applications. • It’s called Node.js
  • 7. What is Node.js ? • In simple words Node.js is ‘server-side JavaScript’. • In not-so-simple words Node.js is a high-performance network applications framework, well optimized for high concurrent environments. • It’s Open Source. It runs well on Linux systems, can also run on Windows systems. • uses an asynchronous event-driven model.
  • 8. What is Node.js ? • Built and run on V8 JavaScript engine. • In ‘Node.js’ , ‘.js’ doesn’t mean that its solely written JavaScript. It is 40% JS and 60% C++. • is now the most followed project on Github, exceeding Ruby on Rails .. woooooo • From the official site: ‘Node's goal is to provide an easy way to build scalable network programs’ - (from nodejs.org!)
  • 9. Google V8 engine • V8 is an open source JavaScript engine developed by Google. It’s written in C++ and is used in Google Chrome Browser. • Faster than SpiderMonkey (used in firefox) over 4 times ( when V8 was invented )  - from an expert on stakoverflow -
  • 10.
  • 11. Theory 1 : Event-loops Event-loops are the core of event-driven programming, almost all the UI programs use event-loops to track the user event, for example: Clicks, Ajax Requests etc. Client Event loop (main thread) C++ Threadpool (worker threads) Clients send HTTP requests to Node.js server An Event-loop is woken up by OS, passes request and response objects to the thread-pool Long-running jobs run on worker threads Response is sent back to main thread via callback Event loop returns result to client
  • 12. Theory 2 : Non-blocking I/O • Traditional I/O var result = db.query(“select x from table_Y”); doSomethingWith(result); //wait for result! doSomethingWithOutResult(); //execution is blocked! • Non-traditional, Non-blocking I/O db.query(“select x from table_Y”,function (result){ doSomethingWith(result); //wait for result! }); doSomethingWithOutResult(); //executes without any delay!
  • 13. Natural & Features of Node.js ( some confusing ) • Apply it in the coolest, sexiest, most popular language on the planet. • Node.js uses an event-driven, non-blocking I/O model, which makes it lightweight. • The big support of V8 from Google is a great power.
  • 14. Why JavaScript was suitable for that ? • JavaScript Callbacks feature that solve the problem of event-loops. • The great NPM (Node Package Manager). • Node.js JavaScript quite different : there is no DOM implementation provided by Node.js, • i.e. you can not do this: var element = document.getElementById(“elementId”); • Everything inside Node.js runs in a single-thread. Natural & Features of Node.js ( some confusing )
  • 15. What can we do with Node.js • You can create an HTTP server and print ‘hello world’ on the browser in just 4 lines of JavaScript. • You can create a DNS server. • You can create a Web Chat Application like GTalk in the browser. • Node.js can also be used for creating online games, collaboration tools or anything which sends updates to the user in Real-time.
  • 17. When to use Node.js ? • streaming based Real-time services, online games, web chat applications,..etc. • If you need high level concurrency and not worried about CPU-cycles. • If you are good at JavaScript code. • You will develop the front-end and back-end in the same language, what a triumph 
  • 18. Some Benchmarks (proof of power) Taken from: http://code.google.com/p/node-js-vs-apache- php-benchmark/wiki/Tests A benchmark between Apache+PHP and node.js, shows the response time for 1000 concurrent connections making 10,000 requests each, for 5 tests.
  • 19. Some Benchmarks (proof of power) Taken from: http://nodejs.org/jsconf2010.pdf The benchmark shows the response time in milli-secs for 4 evented servers.
  • 20. Who is using Node.js Complete list can be found at: https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node
  • 21. Some Modules you will love them • Express– to make things simpler e.g. syntax, DB connections. • Jade – HTML template system • Socket.IO– to create real-time apps • CoffeeScript – for easier JavaScript development Find out more about some widely used Node.js modules at: http://blog.nodejitsu.com/top-node-module-creators
  • 22. The last thing to say (How to start ?!) • Try to explore the rest of Node.js your self. • I recommend a free book to start called • ( O’raily Book : Up and Running With Node.js) • Tutorial sites: • Nodejs.org • Letsnode.com • Google.com • The series of articles in arabic isA on ( medhatdawoud.net)