31
State of the Art Server-Side JavaScript @amorgaut @thibarg 4d.com #10 2011-08-31

State of the art: Server-Side JavaScript (ParisJS)

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

Page 1: State of the art: Server-Side JavaScript  (ParisJS)

State of the ArtServer-Side JavaScript

@amorgaut@thibarg

4d.com

#10

2011-08-31

Page 2: State of the art: Server-Side JavaScript  (ParisJS)

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)

Page 3: State of the art: Server-Side JavaScript  (ParisJS)

History

Page 4: State of the art: Server-Side JavaScript  (ParisJS)

Birth1995 LiveScript/JavaScript

1996 Microsoft JScript (IE4)NetScape Enterprise Server 2aka LiveWire/iPlanet

1997 ECMAScript 1“DHTML”Windows IIS 3

Page 5: State of the art: Server-Side JavaScript  (ParisJS)

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

Page 6: State of the art: Server-Side JavaScript  (ParisJS)

SSJS: The comeback2008Aptana Jaxer CouchDB

2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5

2010Helma NG -> RingoJSSun Phobos

2011Wakanda

Page 7: State of the art: Server-Side JavaScript  (ParisJS)

SSJS: The comeback2008Aptana Jaxer CouchDB

2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5

2010Helma NG -> RingoJSSun Phobos

2011Wakanda

Page 8: State of the art: Server-Side JavaScript  (ParisJS)

SSJS: The comeback2008Aptana Jaxer CouchDB

2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5

2010Helma NG -> RingoJSSun Phobos

2011Wakanda

Page 9: State of the art: Server-Side JavaScript  (ParisJS)

SSJS: The comeback2008Aptana Jaxer CouchDB

2009Narwhal & JackServerJS/CommonJS Node.JSECMAScript 5

2010Helma NG -> RingoJSSun Phobos

2011Wakanda

Page 10: State of the art: Server-Side JavaScript  (ParisJS)

http://en.wikipedia.org/wiki/Comparison_of_server-side_JavaScript_solutions

60+ existing solutions

Page 11: State of the art: Server-Side JavaScript  (ParisJS)

Engines

Page 12: State of the art: Server-Side JavaScript  (ParisJS)

Engines

SpiderMonkeyTraceMonkey (JIT)JägerMonkey (JIT)IonMonkey (JIT)

V8

webkit JavaScriptCore: JSCSquirrelFish Extreme: SFX (JIT)

Nitro

TridentChakra

Tamarin CarakanFuthark

Rhino

Page 13: State of the art: Server-Side JavaScript  (ParisJS)

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++

Page 14: State of the art: Server-Side JavaScript  (ParisJS)

Benchmarks?

Page 15: State of the art: Server-Side JavaScript  (ParisJS)

Persevere JavaScriptDB(April 2009)

http://www.sitepen.com/blog/2009/04/20/javascriptdb-perseveres-new-high-performance-storage-engine/

Page 16: State of the art: Server-Side JavaScript  (ParisJS)

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

Page 17: State of the art: Server-Side JavaScript  (ParisJS)

RingoJS vs NodeJS(September 2010)

http://hns.github.com/2010/09/21/benchmark.html

Page 18: State of the art: Server-Side JavaScript  (ParisJS)

Sunspider 0.9.1(August 2011)

http://expansive-derivation.ossreleasefeed.com/2011/08/javascript-performance-test-results-with-sunspider/

78654321

Page 19: State of the art: Server-Side JavaScript  (ParisJS)

Main Concepts

Page 20: State of the art: Server-Side JavaScript  (ParisJS)

Integration-OrientedRhino

SpiderMonkey in JavaInteraction with Java (APIs and objects)Helma, Persevere, Narwhal*, RingoJS, Sun Phobos...

JScript .NetChakra (C++)Interaction with Windows APIs

Page 21: State of the art: Server-Side JavaScript  (ParisJS)

Async. Event-basedOne single thread

Cooperative («one at a time») with async. callbacks

nodejs (V8)

Page 22: State of the art: Server-Side JavaScript  (ParisJS)

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

Page 23: State of the art: Server-Side JavaScript  (ParisJS)

Thread-basedOne thread per context

Preemptive: Parallel code execution

About all others

Page 24: State of the art: Server-Side JavaScript  (ParisJS)

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

Page 25: State of the art: Server-Side JavaScript  (ParisJS)

Database-drivenCouchDB, MongoDB (SpiderMonkey):

Document Store

Wakanda (JavaScriptCore)Object Store

Page 26: State of the art: Server-Side JavaScript  (ParisJS)

APIs

Page 27: State of the art: Server-Side JavaScript  (ParisJS)

CommonJSModules

Packages

Promises

System

Unit-Testing

Binary

File

JSGI

Stream

http://wiki.commonjs.org/wiki/CommonJS

Page 28: State of the art: Server-Side JavaScript  (ParisJS)

Node.js async APIs

Buffer

Events

File

Net

OS

Process

Streams

Timers

. . .

http://nodejs.org/docs/v0.5.5/api/

Page 29: State of the art: Server-Side JavaScript  (ParisJS)

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

Page 30: State of the art: Server-Side JavaScript  (ParisJS)

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

Page 31: State of the art: Server-Side JavaScript  (ParisJS)

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)