Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SkillSwap node.js
Search
Seth Vargo
September 08, 2012
Technology
2
200
SkillSwap node.js
These are the slides from my tech talk given at skill swap at CMU for SkillSwap Weekend.
Seth Vargo
September 08, 2012
Tweet
Share
More Decks by Seth Vargo
See All by Seth Vargo
Taming the Modern Data Center
sethvargo
11
870
The Ecological Impact of Compute
sethvargo
6
280
Using Terraform with AWS
sethvargo
2
720
Scheduling Applications at Scale
sethvargo
6
500
Easy Ruby Development and Deployment with Otto
sethvargo
0
220
Building the World's Largest Websites
sethvargo
5
530
Consul as a Monitoring Service
sethvargo
22
3.9k
Introduction to Vault
sethvargo
10
2.8k
Vagrant 101 for Designers and Frontend Engineers
sethvargo
1
520
Other Decks in Technology
See All in Technology
4th place solution Eedi - Mining Misconceptions in Mathematics
rist
0
140
入門 PEAK Threat Hunting @SECCON
odorusatoshi
0
150
開発組織を進化させる!AWSで実践するチームトポロジー
iwamot
1
350
30→150人のエンジニア組織拡大に伴うアジャイル文化を醸成する役割と取り組みの変化
nagata03
0
160
Goで作って学ぶWebSocket
ryuichi1208
3
2.7k
OSS構成管理ツールCMDBuildを使ったAWSリソース管理の自動化
satorufunai
0
640
エンジニアリング価値を黒字化する バリューベース戦略を用いた 技術戦略策定の道のり
kzkmaeda
6
2.6k
OCI Success Journey OCIの何が評価されてる?疑問に答える事例セミナー(2025年2月実施)
oracle4engineer
PRO
2
140
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
18k
What's new in Go 1.24?
ciarana
1
110
AWSアカウントのセキュリティ自動化、どこまで進める? 最適な設計と実践ポイント
yuobayashi
7
570
RemoveだらけのPHPUnit 12に備えよう
cocoeyes02
0
280
Featured
See All Featured
Facilitating Awesome Meetings
lara
52
6.2k
Become a Pro
speakerdeck
PRO
26
5.2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
Building Applications with DynamoDB
mza
93
6.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
10
510
Why Our Code Smells
bkeepers
PRO
336
57k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
430
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Cost Of JavaScript in 2023
addyosmani
47
7.4k
Building Adaptive Systems
keathley
40
2.4k
Designing for Performance
lara
604
68k
Transcript
node.js
node
t f g sethvargo
fuck shit dammit ass
what’s node?
event-driven non-blocking server-side
event-driven non-blocking server-side javascript
node’s goal is to provide an easy way to build
scalable network programs
node’s goal is to provide an easy way to build
scalable programs
make shit
make shit ^ better
make shit ^ better ™
Google V8 Engine
Google V8 Engine Makes Javascript really fucking fast ^
this is node
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type':
'text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
complete webserver
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type':
'text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/'); 1 2 3 4 5 6 7 8 ... in just 8 lines
that was node
why node?
new technology
new technology
existing technology
existing technology repurposed
existing technology repurposed patterns
fucking package it has a manager
node package manager
npm
an amazing community
14,350 packages
write less do more
asychronous I/O
“Get the fuck off of my CPU”
var data = file.read('scotty-labs.txt'); complexFileOperation(data); Old I/O
var data = file.read('scotty-labs.txt'); // Tie up the CPU while
I read that file complexFileOperation(data); Old I/O
I want to write the most inefficient program for your
CPU
I want to write the most inefficient program for your
CPU - no one, ever “ ”
Yet you do it every fucking day!
is I/O blocking Ruby Python Java SQL PHP
is I/O blocking Ruby Python Java SQL PHP by default
node is asynchronous
node has asynchronous I/O
var data = file.read('scotty-labs.txt', function(data) { complexFileOperation(data); }); // let
the CPU keep working in the meantime otherFunction(); New I/O
event-driven behavior
after I do this, I need to do that
after I do this, I need to do that
after this, do that
if x, then y
when I’m done shopping, I need to pay the bill
the Ruby way while(!poor) do (@amount ||= 0) += shop
end pay(@amount)
that makes 0 sense
the node way shop(function(amount) { pay(amount); });
fundamentally different way of thinking
fundamentally different type of programming
fundamentally different
and that’s okay
sometimes it really fucking sucks
there’s only one thread
Yay! No threading!
Shit! No threading!
var data = file.read('scotty-labs.txt', function(data) { complexFileOperation(data); }); // let
the CPU keep working in the meantime while(true) { ... } what does this do?
var data = file.read('scotty-labs.txt', function(data) { complexFileOperation(data); }); // let
the CPU keep working in the meantime while(true) { ... } what does this do?
var data = file.read('scotty-labs.txt', function(data) { // never fires });
// blocks the entire thread while(true) { ... } what does this do?
var data = file.read('scotty-labs.txt', function(data) { // never fires });
// blocks the entire thread while(true) { ... } nothing...
“my algorithms are tightly CPU-bound “
“my algorithms are tightly CPU-bound “ don’t use node
let’s code
catman
annoying 5 year old
tcp chat