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
190
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
850
The Ecological Impact of Compute
sethvargo
6
260
Using Terraform with AWS
sethvargo
2
650
Scheduling Applications at Scale
sethvargo
6
480
Easy Ruby Development and Deployment with Otto
sethvargo
0
200
Building the World's Largest Websites
sethvargo
5
500
Consul as a Monitoring Service
sethvargo
22
3.8k
Introduction to Vault
sethvargo
10
2.6k
Vagrant 101 for Designers and Frontend Engineers
sethvargo
1
500
Other Decks in Technology
See All in Technology
ChatworkのSRE部って実は 半分くらいPlatform Engineering部かもしれない
saramune
0
160
SPI原点回帰論:事業課題とFour Keysの結節点を見出す実践的ソフトウェアプロセス改善 / DevOpsDays Tokyo 2024
visional_engineering_and_design
4
1.9k
ゼロから始めるVue.jsコミュニティ貢献 / first-vuejs-community-contribution-link-and-motivation
lmi
1
120
Gitlab本から学んだこと - そーだいなるプレイバック / gitlab-book
soudai
3
130
レガシーをぶっ壊せ。AEONで始めるDevRelの話 / Qiita Night 2024-2-22
aeonpeople
3
1.3k
DevOpsDays History and my DevOps story
kawaguti
PRO
9
2.5k
Vertex AI を中心に 生成AIのアップデートを共有します
kaz1437
0
300
[新卒向け研修資料] テスト文字列に「うんこ」と入れるな(2024年版)
infiniteloop_inc
3
13k
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
180
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
0
190
TechFeed Experts Night#27 〜 フロントエンドフレームワーク最前線 (Svelte)
baseballyama
1
430
GraphQL 成熟度モデルの紹介と、プロダクトに当てはめた事例 / GraphQL maturity model
mh4gf
7
1.3k
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
37
2.5k
Automating Front-end Workflow
addyosmani
1356
200k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
40
4.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
Raft: Consensus for Rubyists
vanstee
132
6.3k
Docker and Python
trallard
34
2.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
How to train your dragon (web standard)
notwaldorf
73
5.2k
Code Reviewing Like a Champion
maltzj
514
39k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
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