Upload
alexandre-morgaut
View
8.248
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Lightening talk presented at ParisJS #10 in 15min Full version should be presented at Wakanday aka JS.everywhere(Boston, October, 15) http://wakanday.org
Citation preview
State of the ArtServer-Side JavaScript
@amorgaut@thibarg
4d.com
#10
2011-08-31
Notes
These slides are part of a 15min version of the talk for ParisJS
The full version will be presented at Wakanday aka JS.everywhere(Boston, October, 15)
History
Birth1995 LiveScript/JavaScript
1996 Microsoft JScript (IE4)NetScape Enterprise Server 2aka LiveWire/iPlanet
1997 ECMAScript 1“DHTML”Windows IIS 3
Maturity1998 - DOM, Mozilla Rhino
1999 - ES3, XMLHttpRequest, HTML 4
2000 - ActionScript, Helma Hop
2001 - JSON, Apple JavaScript OSA
2002 - JSLint
2003 - JavaScript Adobe Press
2004 - E4X , “Web 2.0”
2005 - Prototype, “Ajax”
2006 - Firebug, jQuery, “Comet”, “HTML5”
2007 - SitePoint Persevere, Rhino on Rails
SSJS: The comeback2008Aptana Jaxer CouchDB
2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5
2010Helma NG -> RingoJSSun Phobos
2011Wakanda
SSJS: The comeback2008Aptana Jaxer CouchDB
2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5
2010Helma NG -> RingoJSSun Phobos
2011Wakanda
SSJS: The comeback2008Aptana Jaxer CouchDB
2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5
2010Helma NG -> RingoJSSun Phobos
2011Wakanda
SSJS: The comeback2008Aptana Jaxer CouchDB
2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5
2010Helma NG -> RingoJSSun Phobos
2011Wakanda
http://en.wikipedia.org/wiki/Comparison_of_server-side_JavaScript_solutions
60+ existing solutions
Engines
Engines
SpiderMonkeyTraceMonkey (JIT)JägerMonkey (JIT)IonMonkey (JIT)
V8
webkit JavaScriptCore: JSCSquirrelFish Extreme: SFX (JIT)
Nitro
TridentChakra
Tamarin CarakanFuthark
Rhino
Engines
SpiderMonkeyNarwhal
CouchDB, MongoDBSpidernode
. . .
V8
webkit JavaScriptCore: JSCNarwhalWakanda
. . .
RhinoNarwhalRingoJS
Persevere. . .
NarwhalAkshellNode.js
. . .
C/C++C/C++
C/C++
SpiderMonkey in Java
Trident / ChakraASP / .NET
C/C++
Benchmarks?
Persevere JavaScriptDB(April 2009)
http://www.sitepen.com/blog/2009/04/20/javascriptdb-perseveres-new-high-performance-storage-engine/
Node vs Thin vs Narwhal(september 2009)
http://four.livejournal.com/1019177.html
300 concurrent clients
completed requests:thin 36045node 35668narwhal 2921
> summary(node300$ttime) Min. 1st Qu. Median Mean 3rd Qu. Max. 12.0 66.0 112.0 239.4 157.0 12200.0
> summary(thin300$ttime) Min. 1st Qu. Median Mean 3rd Qu. Max. 71.0 84.0 87.0 208.7 107.0 23950.0
> summary(narwhal300$ttime) Min. 1st Qu. Median Mean 3rd Qu. Max. 928 2837 2935 2921 3018 8759
RingoJS vs NodeJS(September 2010)
http://hns.github.com/2010/09/21/benchmark.html
Sunspider 0.9.1(August 2011)
http://expansive-derivation.ossreleasefeed.com/2011/08/javascript-performance-test-results-with-sunspider/
78654321
Main Concepts
Integration-OrientedRhino
SpiderMonkey in JavaInteraction with Java (APIs and objects)Helma, Persevere, Narwhal*, RingoJS, Sun Phobos...
JScript .NetChakra (C++)Interaction with Windows APIs
Async. Event-basedOne single thread
Cooperative («one at a time») with async. callbacks
nodejs (V8)
Async. Event-basedOne single thread
Cooperative («one at a time») with async. callbacks
nodejs (V8)
Cons
Vulnerable to synchronous operations
Share failure
Doesn’t use other cores
Hard to debug and maintain
Pros
Can handle a lot of requests
Low memory usage
Uses only one core
Thread-basedOne thread per context
Preemptive: Parallel code execution
About all others
Thread-basedOne thread per context
Preemptive: Parallel code execution
About all others
Cons
Memory/CPU limits
Race conditions, deadlocks, ... (internal, C++)
Uses all available cores
Pros
Vertical scalability (cloud)
Thread-safety for concurrent access
Uses all available cores
Database-drivenCouchDB, MongoDB (SpiderMonkey):
Document Store
Wakanda (JavaScriptCore)Object Store
APIs
CommonJSModules
Packages
Promises
System
Unit-Testing
Binary
File
JSGI
Stream
http://wiki.commonjs.org/wiki/CommonJS
Node.js async APIs
Buffer
Events
File
Net
OS
Process
Streams
Timers
. . .
http://nodejs.org/docs/v0.5.5/api/
W3C / HTML5& other standards
Console
Blob, Blob URL*
DataView*
File / FileSystem
Modules*
Progress Events
Structured clones
Typed Arrays*
Web Sockets
Web Storage
Web Workers
XHR 2
Packages & Modulesgithub
lot of commonjs modules in several repositories (Persevere, Narwhal, RingoJS, ...)
NPM: Node Package Manager3600+ packages
CPM: CommonJS Package Manager (new)
http://wiki.commonjs.org/wiki/CommonJS
State of the Art Server-Side JavaScript
The End
@amorgaut@thibarg@wakandasoft
4d.comwakanday.org
@wakandasoft
See the full version of this presentation at Wakanday aka
JS.everywhere(Boston, October, 15)