memaksimalkan non-blocking io pada node.js

17
Memaksimalkan Penggunaan Non Blocking pada Node.js

Upload: codepolitan

Post on 07-Jan-2017

1.234 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Memaksimalkan Non-Blocking IO pada Node.js

Memaksimalkan Penggunaan Non Blocking pada Node.js

Page 2: Memaksimalkan Non-Blocking IO pada Node.js

Rovan AlfarryCTO of SELabSuite

Informatics EngineeringInstitut Teknologi Indonesia

Pixel House StudioJanuary 2016

Nodejs Programmer2015-2016

Page 3: Memaksimalkan Non-Blocking IO pada Node.js

Pixel House StudioFounder: Bramantya Farid in 2010World Class Product (programming, design, video & internet marketing)

Page 4: Memaksimalkan Non-Blocking IO pada Node.js
Page 5: Memaksimalkan Non-Blocking IO pada Node.js

3,4 MillionKeywords

68.000URLs

300Projects

Scraping Google Connect to 7 API

Page 6: Memaksimalkan Non-Blocking IO pada Node.js

Why Node.js?

We hate callback hell

We hate single threaded (single point of failure)

Page 7: Memaksimalkan Non-Blocking IO pada Node.js

Blocked by google (use CURL)

20 seconds per-process

Page 8: Memaksimalkan Non-Blocking IO pada Node.js

Google scraping

5 seconds per-process

Selenium

Page 9: Memaksimalkan Non-Blocking IO pada Node.js

Google scraping

2 seconds per-process

PhantomJS

Page 10: Memaksimalkan Non-Blocking IO pada Node.js
Page 11: Memaksimalkan Non-Blocking IO pada Node.js

Express js Mongodb Monk Phantom js Socket io Request Nodemon PM2

Redis Node

Cluster/NginX/HAProxy

67%

13%

10%

5%5%

Node.js Python PHP

Java ElasticSearch

Technologies

Page 12: Memaksimalkan Non-Blocking IO pada Node.js

Non-blocking + node-sync

Page 13: Memaksimalkan Non-Blocking IO pada Node.js

No standard / No best practice

Catch everything

Node.js handles asynchronous I/O requests with a non-blocking, single-threaded event loop. It is particularly well-suited to distributed systems that make a lot of network requests.

Page 14: Memaksimalkan Non-Blocking IO pada Node.js
Page 15: Memaksimalkan Non-Blocking IO pada Node.js

Memory Leak- Heapdump + Chrome Developer Tools- Force Garbage Collection node --expose-gc app.js -> global.gc()

V8 Memory Limit- node --max-old-space-size=16000 app.js pm2 start bin/www –node-args=“--max-old-space-

size=16000 ”

V8Engine

Page 16: Memaksimalkan Non-Blocking IO pada Node.js

EVERY PRO WAS ONCE AN AMATEUREVERY EXPERT WAS ONCE A BEGINNER

SO KEEP LEARNING

Page 17: Memaksimalkan Non-Blocking IO pada Node.js

Thank You. Any Questions?

Nodejs Indonesia – Telegram Group

We are hiring!

telegram.me/nodejs_jakarta