SlideShare a Scribd company logo
1 of 33
What's so special about Node.js? giancarlo.valente@gmail.com twitter @gncvalente
years of front-end programming evolution now on server-side
javascript
Fundamental videography Ryan Dahl at JS.Conf 2009  show his creature http://jsconf.eu/2009/video_nodejs_by_ryan_dahl.html and also this ... http://vimeo.com/9968301
Fundamental videography Douglas Crockford:  “Crockford on JavaScript  Scene 6: Loopage”  August 2010 http://www.yuiblog.com/blog/2010/08/30/ yui-theater-douglas-crockford-crockford-on-javascript -scene-6-loopage-52-min
node.js is special
What does node.js, nginx, memcached  have in common ?
a C library called libevent
Apache vs Nginx http://blog.webfaction.com/a-little-holiday-present
Apache vs Nginx http://blog.webfaction.com/a-little-holiday-present
apache uses threads nginx uses an event loop
... it's a different approach on building servers ...  with differnt strenghts / weaknesses event loop approach  scales better when has to serve  many clients  with requests that doesn't need  so much "data crunching" elaboartion,  but a lot of I/O
Ryan's idea!  node.js is a thin layer  that glue 3 libraries togheter: V8 js engine  +  libev (event loop)  +  libeio (async I/O)
blocking I/O historically all programming languages have blocking I/O
but, a problem arise: the very expensive "data processing machine" is not used in a very efficient way
multi user systems use of timesharing,  in order to make the same computer multiuser
in our modern "server side" code, the same thing appens how do we solve this? simple, we do the same thing.  We invented the Threads!
but now the situation is like this Help !!! web real-time, long running sockets ... I've sent the newsletter with 90% discount !!! traffic jam !
has a different approach
event loop approach event loop is used from many years in: games graphical UIs ... servers
single thread server c1, c2, c3, c4 ---> S ---> I/O
multi-thread server c1 ---> T1 ---> I/O c2 ---> T2 ---> I/O c3 ---> T3 ---> I/O c4 ---> T4 ---> I/O
thread pool server c9, c5, c1  ---> T1 ---> I/O c10, c6, c2 ---> T2 ---> I/O c11, c7, c3 ---> T3 ---> I/O c12, c8, c4 ---> T4 ---> I/O
event loop c1 ---> ST --> async I/O c2 --->  c3 --->                  c4 --->                  c5 --->                  c6 --->                  c7 --->                  c8 --->                  c9 --->                  c10 --->                   c11 --->                   c12 --->
so what's the point ... also the browser is  mono-thread and works  with an event loop
when we write setTimeout('timeout_trigger()', 2000) we're not creating a new thread! (as sometimes I've heard ...) but we're subscribing  a new event,  which will run our callback,  2 seconds from now
so ... why all this hype ? who are the most expert professionals in event driven programming with non blocking I/O ?
the one that do this from years! front-end developers!
accidental evolution of a language (video) http://www.yuiblog.com/blog/2010/08/30/ yui-theater-douglas-crockford-crockford-on-javascript -scene-6-loopage-52-min
part 2
Do we all jump on the node.js train? maybe sometimes but it's important to understand what are the strenght of node so we can know how and when to use it.
alternatives ? yes, but we can talk about them next time ... :)
weaknesses monothread (?) (also principal strength point) .. you've to follow the rules non blocking operations, develop in evented style

More Related Content

What's hot

Android and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout jsAndroid and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout jsmusart Park
 
Nodebot: Arte de controlar arduino com javascript
Nodebot: Arte de controlar arduino com javascriptNodebot: Arte de controlar arduino com javascript
Nodebot: Arte de controlar arduino com javascriptDesiree Santos
 
2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기
2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기
2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기JunHo Kim
 

What's hot (9)

Y server
Y serverY server
Y server
 
vmod workshop
vmod workshopvmod workshop
vmod workshop
 
Functional javascript
Functional javascriptFunctional javascript
Functional javascript
 
Perl containers
Perl containersPerl containers
Perl containers
 
Android and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout jsAndroid and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout js
 
Skyfall b sides-c00-l-ed5-sp-2013
Skyfall b sides-c00-l-ed5-sp-2013Skyfall b sides-c00-l-ed5-sp-2013
Skyfall b sides-c00-l-ed5-sp-2013
 
Nodebot: Arte de controlar arduino com javascript
Nodebot: Arte de controlar arduino com javascriptNodebot: Arte de controlar arduino com javascript
Nodebot: Arte de controlar arduino com javascript
 
Node.js
Node.jsNode.js
Node.js
 
2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기
2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기
2019.06.01 Konva.js 와 함께하는 canvas 2D 그래픽. 유튜브 썸네일 (미리보기 이미지) 제작툴 만들기
 

Similar to What's so special about node.js

44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON
 
Gatling - JUGL, 2012-09-13
Gatling  - JUGL, 2012-09-13Gatling  - JUGL, 2012-09-13
Gatling - JUGL, 2012-09-13Nicolas Rémond
 
Metasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on ArduinoMetasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on ArduinoKiwamu Okabe
 
HTML5: New UI Library for Games - Chad Austin
HTML5: New UI Library for Games - Chad AustinHTML5: New UI Library for Games - Chad Austin
HTML5: New UI Library for Games - Chad AustinChad Austin
 
4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to know4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to knowDynatrace
 
Docker in Production: Reality, Not Hype - DevOps Chicago
Docker in Production: Reality, Not Hype - DevOps ChicagoDocker in Production: Reality, Not Hype - DevOps Chicago
Docker in Production: Reality, Not Hype - DevOps Chicagobridgetkromhout
 
DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...
DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...
DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...Felipe Prado
 
Webgl 기술동향 2011.8
Webgl 기술동향 2011.8Webgl 기술동향 2011.8
Webgl 기술동향 2011.8Seung Joon Choi
 
Node Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesNode Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesMakoto Inoue
 
Speeding up Programs with OpenACC in GCC
Speeding up Programs with OpenACC in GCCSpeeding up Programs with OpenACC in GCC
Speeding up Programs with OpenACC in GCCinside-BigData.com
 
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfOpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfssuser866937
 
Isolating GPU Access in its Own Process
Isolating GPU Access in its Own ProcessIsolating GPU Access in its Own Process
Isolating GPU Access in its Own ProcessPatricia Aas
 
Laptop Chip level repairing(CPU section)
Laptop Chip level repairing(CPU section)Laptop Chip level repairing(CPU section)
Laptop Chip level repairing(CPU section)chiptroniks
 
laptop repairing institute
laptop repairing institutelaptop repairing institute
laptop repairing institutechiptroniks
 
laptop repairing institute
laptop repairing institutelaptop repairing institute
laptop repairing institutechiptroniks
 
TomcatCon: from a cluster to the cloud
TomcatCon: from a cluster to the cloudTomcatCon: from a cluster to the cloud
TomcatCon: from a cluster to the cloudJean-Frederic Clere
 
Droids, java script and web connected hardware
Droids, java script and web connected hardwareDroids, java script and web connected hardware
Droids, java script and web connected hardwareAndrew Fisher
 
Integrating cloud stack with puppet
Integrating cloud stack with puppetIntegrating cloud stack with puppet
Integrating cloud stack with puppetPuppet
 

Similar to What's so special about node.js (20)

44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
 
Gatling - JUGL, 2012-09-13
Gatling  - JUGL, 2012-09-13Gatling  - JUGL, 2012-09-13
Gatling - JUGL, 2012-09-13
 
Metasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on ArduinoMetasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on Arduino
 
HTML5: New UI Library for Games - Chad Austin
HTML5: New UI Library for Games - Chad AustinHTML5: New UI Library for Games - Chad Austin
HTML5: New UI Library for Games - Chad Austin
 
4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to know4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to know
 
Docker in Production: Reality, Not Hype - DevOps Chicago
Docker in Production: Reality, Not Hype - DevOps ChicagoDocker in Production: Reality, Not Hype - DevOps Chicago
Docker in Production: Reality, Not Hype - DevOps Chicago
 
DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...
DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...
DEF CON 27 - GRICHTER - reverse engineering 4g hotspots for fun bugs net fina...
 
Webgl 기술동향 2011.8
Webgl 기술동향 2011.8Webgl 기술동향 2011.8
Webgl 기술동향 2011.8
 
Node Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesNode Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup Slides
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
Speeding up Programs with OpenACC in GCC
Speeding up Programs with OpenACC in GCCSpeeding up Programs with OpenACC in GCC
Speeding up Programs with OpenACC in GCC
 
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfOpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
 
Isolating GPU Access in its Own Process
Isolating GPU Access in its Own ProcessIsolating GPU Access in its Own Process
Isolating GPU Access in its Own Process
 
Laptop Chip level repairing(CPU section)
Laptop Chip level repairing(CPU section)Laptop Chip level repairing(CPU section)
Laptop Chip level repairing(CPU section)
 
laptop repairing institute
laptop repairing institutelaptop repairing institute
laptop repairing institute
 
laptop repairing institute
laptop repairing institutelaptop repairing institute
laptop repairing institute
 
TomcatCon: from a cluster to the cloud
TomcatCon: from a cluster to the cloudTomcatCon: from a cluster to the cloud
TomcatCon: from a cluster to the cloud
 
(C)NodeJS
(C)NodeJS(C)NodeJS
(C)NodeJS
 
Droids, java script and web connected hardware
Droids, java script and web connected hardwareDroids, java script and web connected hardware
Droids, java script and web connected hardware
 
Integrating cloud stack with puppet
Integrating cloud stack with puppetIntegrating cloud stack with puppet
Integrating cloud stack with puppet
 

Recently uploaded

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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Recently uploaded (20)

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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

What's so special about node.js

  • 1. What's so special about Node.js? giancarlo.valente@gmail.com twitter @gncvalente
  • 2. years of front-end programming evolution now on server-side
  • 4. Fundamental videography Ryan Dahl at JS.Conf 2009 show his creature http://jsconf.eu/2009/video_nodejs_by_ryan_dahl.html and also this ... http://vimeo.com/9968301
  • 5. Fundamental videography Douglas Crockford: “Crockford on JavaScript Scene 6: Loopage” August 2010 http://www.yuiblog.com/blog/2010/08/30/ yui-theater-douglas-crockford-crockford-on-javascript -scene-6-loopage-52-min
  • 7. What does node.js, nginx, memcached have in common ?
  • 8. a C library called libevent
  • 9. Apache vs Nginx http://blog.webfaction.com/a-little-holiday-present
  • 10. Apache vs Nginx http://blog.webfaction.com/a-little-holiday-present
  • 11. apache uses threads nginx uses an event loop
  • 12. ... it's a different approach on building servers ... with differnt strenghts / weaknesses event loop approach scales better when has to serve many clients with requests that doesn't need so much "data crunching" elaboartion, but a lot of I/O
  • 13. Ryan's idea! node.js is a thin layer that glue 3 libraries togheter: V8 js engine + libev (event loop) + libeio (async I/O)
  • 14. blocking I/O historically all programming languages have blocking I/O
  • 15. but, a problem arise: the very expensive "data processing machine" is not used in a very efficient way
  • 16. multi user systems use of timesharing, in order to make the same computer multiuser
  • 17. in our modern "server side" code, the same thing appens how do we solve this? simple, we do the same thing. We invented the Threads!
  • 18. but now the situation is like this Help !!! web real-time, long running sockets ... I've sent the newsletter with 90% discount !!! traffic jam !
  • 19. has a different approach
  • 20. event loop approach event loop is used from many years in: games graphical UIs ... servers
  • 21. single thread server c1, c2, c3, c4 ---> S ---> I/O
  • 22. multi-thread server c1 ---> T1 ---> I/O c2 ---> T2 ---> I/O c3 ---> T3 ---> I/O c4 ---> T4 ---> I/O
  • 23. thread pool server c9, c5, c1 ---> T1 ---> I/O c10, c6, c2 ---> T2 ---> I/O c11, c7, c3 ---> T3 ---> I/O c12, c8, c4 ---> T4 ---> I/O
  • 24. event loop c1 ---> ST --> async I/O c2 ---> c3 ---> c4 ---> c5 ---> c6 ---> c7 ---> c8 ---> c9 ---> c10 ---> c11 ---> c12 --->
  • 25. so what's the point ... also the browser is mono-thread and works with an event loop
  • 26. when we write setTimeout('timeout_trigger()', 2000) we're not creating a new thread! (as sometimes I've heard ...) but we're subscribing a new event, which will run our callback, 2 seconds from now
  • 27. so ... why all this hype ? who are the most expert professionals in event driven programming with non blocking I/O ?
  • 28. the one that do this from years! front-end developers!
  • 29. accidental evolution of a language (video) http://www.yuiblog.com/blog/2010/08/30/ yui-theater-douglas-crockford-crockford-on-javascript -scene-6-loopage-52-min
  • 31. Do we all jump on the node.js train? maybe sometimes but it's important to understand what are the strenght of node so we can know how and when to use it.
  • 32. alternatives ? yes, but we can talk about them next time ... :)
  • 33. weaknesses monothread (?) (also principal strength point) .. you've to follow the rules non blocking operations, develop in evented style