3. Datei Uploads & Umwandlung als Infrastruktur
Service für Web- & Mobile-Apps.
- The app we run in production
4. Core Contributor
&
Module Author
node-mysql node-formidable
- Joined the mailing list in June 26, 2009
- When I joined there where #24 people
- First patch in September 2009
- Now mailing list has > 3400 members
5. node @ devcon?
Who is doing JavaScript?
Has used node?
Is using node in production (an app that is running this very moment)?
11. Serverseitiges JavaScript
• Netscape LiveWire (1996)
• Rhino (1997)
• 50+ weitere Plattformen
LiveWire to script enterprise appliances
Rhino was done because the plan was to rewrite netscape entirely in Java (Javagator)
Wikipedia lists 50+ other plattform since then
12. Was war das Problem?
• Langsame Engines
• Wenig Interesse an JavaScript bis ~2005
• Bessere alternativen
18. Blocking I/O
var a = db.query('SELECT A');
console.log('result a:', a);
var b = db.query('SELECT B');
console.log('result b:', b);
Dauer = SUM(A, B)
Disk / Network access is 1.000-1.000.000 slower than CPU / Ram access
19. I/O im Verhältnis
• CPU / Ram: Sehr Schnell
• Disk / Netzwerk: 1.000x - 1.000.000x
langsamer
21. Non-Blocking I/O
• I/O Aufgaben an den Kernel weitergeben
und events durch file descriptor polling
erkannt (select, epoll, kqueue, etc.)
• Thread pool für alles andere
22. Single Threaded
var a = [];
function first() {
a.push(1);
a.push(2);
}
function second() {
a.push(3);
a.push(4);
}
setTimeout(first, 10);
setTimeout(second, 10);
23. Single Threaded
var a = [];
function first() {
a.push(1); • [1, 2, 3, 4] ?
a.push(2);
}
• [3, 4, 1, 2] ?
function second() {
a.push(3);
a.push(4); • [1, 3, 2, 4] ?
}
setTimeout(first, 10);
• BAD_ACCESS ?
setTimeout(second, 10);
Who thinks:
- Answer not on the list?
- A possible?
- B possible?
- C possible?
24. Single Threaded
var a = [];
function first() {
a.push(1); • [1, 2, 3, 4]
a.push(2);
}
• [3, 4, 1, 2]
function second() {
a.push(3);
a.push(4); • [1, 3, 2, 4]
}
setTimeout(first, 10);
• BAD_ACCESS
setTimeout(second, 10);
Who thinks:
- Answer not on the list?
- A possible?
- B possible?
- C possible?
28. Andere Beispiele
• Single Page Apps
• File uploads
• Unix tools parallel laufen lassen
http://teddziuba.com/2011/02/the-case-against-queues.html
“I love asynchronous stuff as much as the next guy, but think of a queue like Java: it
encourages large swaths of mediocre programmers to overengineer shit, and it keeps
systems administrators in business by giving them something to respond to at 4AM.” -- Ted
Dziuba
44. Probleme
• Stack traces gehen an der event loop
Grenze verloren
• Aufgaben auf mehrere Prozesse verteilen
• V8: 1- 1.9 GB heap limit / GC Probleme
+ not as many libraries as the ruby ecosystem