javascript goes enterprise - node.js-anwendungen mit visual studio und den node.js-tools entwickeln
Post on 15-Apr-2017
256 Views
Preview:
TRANSCRIPT
JavaScript goes EnterpriseNode.js-Anwendungen
mit Visual Studio entwickeln
Agenda
• Einführung in Node.js
• Node.js und .NET
• Anwendungsfälle und Beispiele
• Fazit
Einführung in Node.js
Node.js• Node.js ist eine plattformübergreifende
Laufzeitumgebung für JavaScript-Anwendungen.
• Node.js ermöglicht die einfache Entwicklung von schnellen und skalierbaren JavaScript-Applikationen.
• Node.js JavaScript-Anwendungen laufen typischerweise auf einem Server.
Der ErfinderRyan Dahl: „Node.js, Evented I/O for V8 Javascript“
JSConf.EU, Sunday November 8th, 2009
node.js in brief (2009)
• Server-Side JavaScript
• Built on Google’s V8
• Evented, Non-Blocking I/O
• CommonJS module system
• 8000 lines of C/C++, 2000 lines of JavaScript (14 Contributor)
http://www.youtube.com/watch?v=ztspvPYybIY
What ist V8?• V8 is Google's open source high-
performance JavaScript engine, written in C++ and used in Google Chrome, the open source browser from Google.
• It implements ECMAScript as specified in ECMA-262, 3rd edition, and runs on Windows XP and Vista, Mac OS X 10.5+, and Linux systems that use IA-32, ARM or MIPS processors.
• V8 can run standalone, or can be embedded into any C++ application.
https://developers.google.com/v8/
node standard library
node bindings (http, socket, file system)
V8 thread pool (libeio)
event loop (libev)
cypto (OpenSSL)
DNC (c-ares)
JavaScript
C/C++
Node.js - Architektur
• Single Threaded
• Asynchronous
• Event Loop
• Non blocking I/O
Ryan Dahl„I/O needs to be done differently“
Ryan Dahl„In many cases, just waiting for the response“
Klassische ServerMulti-Threaded - Blocking I/O
http://blog.cloudfoundry.com/2012/06/27/future-proofing-your-apps-cloud-foundry-and-node-js/
Ryan Dahl„This is the node.js project: To provide a purely evented, non-blocking infrastructure to script highly concurrent programs“
Node.jsSingle Threaded, Event Loop, Non-Blocking I/O
http://blog.cloudfoundry.com/2012/06/27/future-proofing-your-apps-cloud-foundry-and-node-js/
Single Threaded, Event Loop, Non-Blocking I/O
• Weniger Speicherverbrauch
• Weniger CPU-Overhead
• Bessere Skalierbarkeit
Fundamentals!• Globals • STDIO • Timers • Modules • Events • Buffers • Streams • C/C++ Addons
Network I/O!• HTTP • HTTPS • URL • Query Strings • Net • UDP/Datagram • DNS
File system I/O!• File System • Path Process I/O / V8 VM!• Process • VM • Child Processes • Cluster
Terminal/Console!• REPL • Readline • TTY
Testing & debugging!• Assertion Testing • Debugger • Utilities
Misc!• Crypto • TLS/SSL • String Decoder • ZLIB • OS
http://nodejs.org/api/modules.html
Node.js Core Modules
Node.js Module
Node.js und .NET
Node.js und .NET• Node.js für Windows
• http://nodejs.org/
• Node.js Tools for Visual Studio (NTVS)
• https://nodejstools.codeplex.com/
• Edge.js
• http://tjanczuk.github.io/edge/
npm install edge
VS.NET + NTVS• Verschiedene Projektvorlagen
• Integration der Node.js-Paketverwaltung (npm)
• JavaScript-Code-Vervollständigung (Intellisense)
• Node.js-Interactive Window
• Node.js-Debugger-Integration
• Windows Azure Veröffentlichung
Edge.js
• npm-Module und nuget-Pakete für die Integration von Node.js und .NET auf Prozessebene
• Für C#, F#, Python (mit IronPython) und Windows PowerShell
http://tjanczuk.github.io/edge/
„Edge.js is 32x faster than a cross-process call“
https://github.com/tjanczuk/edge/wiki/Performance
Kleiner Exkurs: Node.js und Java
http://nodyn.io/
Anwendungsfälle und Beispiele
Anwendungsfälle• The Internet of Things
• E-Commerce
• Payment Processing
• Social Media
• Realtime Services
• Media
• Enterprise Web Services
IBM und Node.js
• „When you add thousands of devices to a network it’s going to be impossible to program in the same way we program computers today. IBM is working on Node-RED a tool to help “wire” the internet of things.“
http://nodered.org/
LinkedIn und Node.js
• Anforderung: „Mobilen App-Infrastruktur“
• Weniger Code
• Weniger Ressourcen - von 30 auf 3 Server
• Schneller - teilweise bis 20x
• Stabiler
http://highscalability.com/blog/2012/10/4/linkedin-moved-from-rails-to-node-27-servers-cut-and-up-to-2.html
Groupon und Node.js• Anforderung:
„50.000 Requests / Minute“
• Node.js-Infrastruktur schafft diese Datenverkehr mit weniger Hardware
• Ladezeiten verbessern sich um 50%
• Globale Änderungen lassen sich schneller realisieren und verteilen
http://www.datacenterknowledge.com/archives/2013/12/06/need-speed-groupon-migrated-node-js/
Walmart und Node.js• Anforderung:
„Black Friday“
• 55% des Datenverkehrs wurde über Node.js-Server verarbeitet, ohne einen einzigen Serverausfall
• Die durchschnittliche CPU-Auslastung lag bei 1%
• Softwareverteilung bei 200.000.000 aktiven Nutzern
http://www.joyent.com/developers/videos/node-js-at-walmart-going-to-production-debugging-monitoring
Yahoo und Node.js
• Ca. 200 Entwickler programmieren für Node.js
• 500 interne Node-Module
• 800 externe Node-Module
• Node.js-Services verarbeiten bis zu 2.000.000 Requests /Minute
Build 2013 - Channel 9June 28, 2013:
„Doug Crockford and Steve Lucco on JavaScript“
Paypal und Node.js• Anforderung:
„Java versus JavaScript“
• Weniger Entwickler, weniger Code (LoC) in der Hälfte der Zeit
• Verdoppelung der Anzahl der Anfragen pro Sekunde (Requests/sec)
• Steigerung der Antwortzeit um 35% auf 200 ms
• Umsetzung von 12 Node.js-Anwendungen in sechs Monaten
• Alle zukünftigen Anwendungen werden in Node.js entwickelt
Bill Scott: “Clash of the Titans: Releasing the Kraken NodeJS @paypal"
http://www.youtube.com/watch?v=tZWGb0HU2QM
Node.js - Nicht nur für’s Web:
Fazit
Was wäre wenn• Verringerung der Entwicklerkapazitäten
• Verringerung der Seitenladezeit
• Verringerung der Anzahl von Servern
• Zufriedene Kunden
• Zufriedene Entwickler
„Get Happy with Node.js“!
;-) Vielen Dank!
top related