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
210
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
880
The Ecological Impact of Compute
sethvargo
6
290
Using Terraform with AWS
sethvargo
2
740
Scheduling Applications at Scale
sethvargo
6
510
Easy Ruby Development and Deployment with Otto
sethvargo
0
250
Building the World's Largest Websites
sethvargo
5
540
Consul as a Monitoring Service
sethvargo
22
4k
Introduction to Vault
sethvargo
10
2.9k
Vagrant 101 for Designers and Frontend Engineers
sethvargo
1
530
Other Decks in Technology
See All in Technology
Kiroと学ぶコンテキストエンジニアリング
oikon48
6
7.2k
絶対に失敗できないキャンペーンページの高速かつ安全な開発、WINTICKET × microCMS の開発事例
microcms
0
360
5年目から始める Vue3 サイト改善 #frontendo
tacck
PRO
2
130
役割は変わっても、変わらないもの 〜スクラムマスターからEMへの転身で学んだ信頼構築の本質〜 / How to build trust
shinop
0
160
ここ一年のCCoEとしてのAWSコスト最適化を振り返る / CCoE AWS Cost Optimization devio2025
masahirokawahara
1
1.3k
サンドボックス技術でAI利活用を促進する
koh_naga
0
150
まだ間に合う! StrandsとBedrock AgentCoreでAIエージェント構築に入門しよう
minorun365
PRO
11
750
攻撃と防御で実践するプロダクトセキュリティ演習~導入パート~
recruitengineers
PRO
4
1.8k
実践データベース設計 ①データベース設計概論
recruitengineers
PRO
4
2k
Function Body Macros で、SwiftUI の View に Accessibility Identifier を自動付与する/Function Body Macros: Autogenerate accessibility identifiers for SwiftUI Views
miichan
2
150
制約理論(ToC)入門
recruitengineers
PRO
9
3.7k
Automating Web Accessibility Testing with AI Agents
maminami373
0
470
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
339
57k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
[RailsConf 2023] Rails as a piece of cake
palkan
56
5.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Designing for humans not robots
tammielis
253
25k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Bash Introduction
62gerente
614
210k
The Invisible Side of Design
smashingmag
301
51k
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