Node - ai.dmi.unibas.ch · Node.js “Node.js uses an event-driven, non-blocking I/O model that...

Post on 23-Mar-2020

5 views 0 download

Transcript of Node - ai.dmi.unibas.ch · Node.js “Node.js uses an event-driven, non-blocking I/O model that...

Node.jsLuis Ackermann

25. November 2014

Seminar: Open-Source-Softwareentwicklung HS2014, Universität Basel

JavaScript• Dynamic type-checking

• Wert bestimmt Datentyp, nicht Variable

• Ermöglicht sehr flexibles Entwickeln

• Weakly typed

• Funktionen sind typ-ungebunden

• Objekte lassen sich dynamisch erweitern

• Truthy & Falsy Variablen

Node.js

• JavaScript Laufzeit-Umgebung

• JIT-Kompilierung mit V8

• Single-threaded, easily scalable

Node.js

“Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.”

— nodejs.org

Blocking I/O

Request Handler

Request Thread

Thread

Thread

Request Handler

Request Thread

Thread

Thread

Blocking I/O

Request Handler

Thread

Thread

ThreadRequest

Request

Blocking I/O

Request Handler

Thread

Thread

Thread

Response

Blocking I/O

Request Handler

Request Thread

Thread

Thread

Blocking I/O

Request Handler

Thread

Thread

Thread

Request

Request

🕑

🕑

Blocking I/O

Non-blocking I/O

Event Loop

Request

Request

Request

Non-blocking I/O

Event Loop IO

IO

IORequest

Request

Request

Non-blocking I/O

Event Loop IO

IO

IO

Response

Non-blocking I/O

Event Loop IO

IO

Non-blocking I/O

Event Loop IO

IO

IO

Request

Request

Non-blocking I/O

Event Loop IO

IO

IO

IO

IO

Request

Request

Non-blocking I/O

Event Loop IO

IO

IO

IO

IO

Request

Request

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

IO

Quelle: loadimpact.com

⦿ Concurrent Users ⦿ Response Time⦿ CPU Usage

Beispiel

Danke für die Aufmerksamkeit