1. Trang chủ
  2. » Công Nghệ Thông Tin

lập trình NodeJS ppt

9 228 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 9
Dung lượng 1,65 MB

Nội dung

a server-side solution for JS ◦ Compiles JS, making it really fast  Runs over the command line  Designed for high concurrency ◦ Without threads or new processes  Never blocks, not eve

Trang 1

By: Michael Jhun Angelo Bea

Trang 2

 A JavaScript runtime environment running Google Chrome’s V8 engine

◦ a.k.a a server-side solution for JS

◦ Compiles JS, making it really fast

 Runs over the command line

 Designed for high concurrency

◦ Without threads or new processes

 Never blocks, not even for I/O

 Uses the CommonJS framework

◦ Making it a little closer to a real OO language

Trang 3

 JavaScript used in client-side but node.js

puts the JavaScript on server-side thus making communication between client and server will happen in same language

 Servers are normally thread based but

Node.JS is “Event” based Node.JS serves each request in a Evented loop that can able to handle simultaneous requests

Trang 4

Node.JS programs are executed by V8

Javascript engine the same used by Google chrome browser

Trang 5

"Node is similar in design to and

influenced by systems like Ruby's event

machine or Python's twisted Node takes the event model a bit further—it presents the

event loop as a language construct instead of

as a library."

Trang 6

 Instead of threads Node uses an event loop with a stack

 Alleviates overhead of context switching

Trang 7

 Request for “index.html” comes in

 Stack unwinds and ev_loop goes to sleep

 File loads from disk and is sent to the client

Trang 8

 Servers do nothing but I/O

 To avoid blocking, Node makes use of the event driven nature of JS by attaching callbacks to I/O requests

 Scripts waiting on I/O waste no space because

they get popped off the stack when their non-I/O related code finishes executing

Trang 9

“The shorter the better!!!”

Thanks for listening! 

Ngày đăng: 29/11/2016, 13:07

TỪ KHÓA LIÊN QUAN

w