Your SlideShare is downloading. ×
Node.js Introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Node.js Introduction

7,237
views

Published on

in Joomladay 2013 Bangkok

in Joomladay 2013 Bangkok

Published in: Technology

0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,237
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
16
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. node.js introduction of server side javascript Saturday, November 23, 13
  • 2. Sira Sujjinanont @hunt Managing Director Webiz Co.,Ltd. CTO Jitta.com 15 years in Web development Saturday, November 23, 13
  • 3. Web Development Journey • Static HTML • PERL/CGI (2 years) • PHP (11 years) • • • CMS > Drupal, Wordpress, Joomla Framework > Yii, Zend, CodeIgniter, … What’s next?!? Saturday, November 23, 13
  • 4. PHP bad parts • Consume a lot of memories • Cannot do Realtime Application • Cannot deal direct with protocol layer • No parallel processing Saturday, November 23, 13
  • 5. What I need in the next? • Easy to learn (for me and for my team) • Fast / Scalability • Allow us to dig deep in engineering • New technology! New boundary! • Open source with great community Saturday, November 23, 13
  • 6. And node.js came up! (server-side javascript) but we need to dig it deep!! Saturday, November 23, 13
  • 7. Why Javascript? • Easy to learn and understanding! • Front-end coder can do backend immediately! • Javascript Engine war! (huge changed on web industry) • Non-blocking I/O • One language on both front and back!!! Saturday, November 23, 13
  • 8. Server-side javascript • Netscape LiveWrite 1996 • Rhino 1997 • and over 50 platforms! Saturday, November 23, 13
  • 9. Many problems! • Slow engines • Lag of interest in Javascript language (until 2005… ajax trend!) • Great competitors platform and language Saturday, November 23, 13
  • 10. • Created by Ryan Dahl in 2009 easily building fast, scalable network applications • Google V8 Javascript Engine (Same technology in Google Chrome) • NPM Package Manager (Come by default great as it should be: 48,362 modules) • Realtime, Command line, Many tools Saturday, November 23, 13
  • 11. When do we need a web? • Download web server and install • Install PHP and maybe database • Configuration…. • And now we can put our code on it! Saturday, November 23, 13
  • 12. See Node.js way! (create a web server, just in 6 lines of code) 1 Download and click install apt-get install nodejs 2 var http = require('http'); http.createServer(function (req, res) { res.writeHead(200); res.end("Hello World!n"); }).listen(3000); console.log('Server running at http://localhost:3000/'); Saturday, November 23, 13
  • 13. It just works! Web server and ready for a huge traffic :) even 10,000/reqs var http = require('http'); http.createServer(function (req, res) { res.writeHead(200); res.end("Hello World!n"); }).listen(3000); console.log('Server running at http://localhost:3000/'); Saturday, November 23, 13
  • 14. Blocking I/O var a = db.query(“SELECT * FROM users”); console.log(‘Result a:’, a); var b = db.query(“SELECT * FROM documents”); console.log(‘Result B:’, b); Saturday, November 23, 13
  • 15. Blocking I/O var a = db.query(“SELECT * FROM users”); console.log(‘Result a:’, a); wait var b = db.query(“SELECT * FROM documents”); console.log(‘Result B:’, b); Waste cpu cycles from waiting… other part of code, they need to wait too! Saturday, November 23, 13 wait
  • 16. Blocking I/O var a = db.query(“SELECT * FROM users”); console.log(‘Result a:’, a); wait var b = db.query(“SELECT * FROM documents”); console.log(‘Result B:’, b); sum ( a + b) Saturday, November 23, 13 wait
  • 17. Non Blocking I/O var a = db.query(“SELECT * FROM users”, function(result){ console.log(‘Result a:’, a); } ); var b = db.query(“SELECT * FROM documents”, function(result){ console.log(‘Result b:’, ab); } ); Saturday, November 23, 13
  • 18. Non Blocking I/O var a = db.query(“SELECT * FROM users”, function(result){ console.log(‘Result a:’, a); } ); run parallel var b = db.query(“SELECT * FROM documents”, function(result){ console.log(‘Result b:’, ab); } ); max ( a, b ) Saturday, November 23, 13 run parallel
  • 19. Benchmark nginx (non blocking i/o) Saturday, November 23, 13 apache (blocking i/o)
  • 20. Suitable Applications • Single page app • Full web app • Realtime app chat, notification, games • Crawler, Bot • Streaming • File uploading Saturday, November 23, 13
  • 21. Who using now? and thousand thousand more… including me... Molome .... Saturday, November 23, 13
  • 22. You should try! • It’s not hard to start if you familiar with Javascript • If you looking for another language • It’ll change the way you do a web • And it’s FUN!! Saturday, November 23, 13
  • 23. Start now! http://github.com/hunt/seventies template for node.js web application by me! https://github.com/jlleblanc/nodejs-joomla module for Joomla Saturday, November 23, 13
  • 24. Q&A Free to ask! Saturday, November 23, 13