• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Node.js Introduction
 

Node.js Introduction

on

  • 4,329 views

in Joomladay 2013 Bangkok

in Joomladay 2013 Bangkok

Statistics

Views

Total Views
4,329
Views on SlideShare
4,329
Embed Views
0

Actions

Likes
5
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Node.js Introduction Node.js Introduction Presentation Transcript

    • node.js introduction of server side javascript Saturday, November 23, 13
    • Sira Sujjinanont @hunt Managing Director Webiz Co.,Ltd. CTO Jitta.com 15 years in Web development Saturday, November 23, 13
    • 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
    • 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
    • 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
    • And node.js came up! (server-side javascript) but we need to dig it deep!! Saturday, November 23, 13
    • 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
    • Server-side javascript • Netscape LiveWrite 1996 • Rhino 1997 • and over 50 platforms! Saturday, November 23, 13
    • Many problems! • Slow engines • Lag of interest in Javascript language (until 2005… ajax trend!) • Great competitors platform and language Saturday, November 23, 13
    • • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • Benchmark nginx (non blocking i/o) Saturday, November 23, 13 apache (blocking i/o)
    • Suitable Applications • Single page app • Full web app • Realtime app chat, notification, games • Crawler, Bot • Streaming • File uploading Saturday, November 23, 13
    • Who using now? and thousand thousand more… including me... Molome .... Saturday, November 23, 13
    • 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
    • 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
    • Q&A Free to ask! Saturday, November 23, 13