18
Firehose Building a real-time data stream with NodeJS Luca Grulla@Forward London, 2/8/2011

Firehose

Embed Size (px)

DESCRIPTION

how we built a firehose with NodeJS and ZeroMQ

Citation preview

Page 1: Firehose

FirehoseBuilding a real-time data stream with NodeJS

Luca Grulla@ForwardLondon, 2/8/2011

Page 2: Firehose

Introduction

Or what we wanted to build

Page 3: Firehose

We like to have a (near) real-time view of the data stream

Page 4: Firehose

Resilient

Page 5: Firehose

Scalable

Page 6: Firehose

Accurate(but not necessarily precise)

Page 7: Firehose
Page 8: Firehose

Verse and Chorus

Or how we built it

Page 9: Firehose

Stack

• NodeJS (0.4.9)• CoffeeScript• ZeroMQ

Page 10: Firehose

Architecture

Page 11: Firehose

Interlude

Or joys and pitfalls of building a tail library for node

Page 12: Firehose

Living the asynchronous dream

Page 13: Firehose

Living the asynchronous dream

• Error manifests itself only at high throughput (7MB/secs)

• The few implementations you can find around are wrong (including Log.io – we are planning to contribute back)

Page 14: Firehose

Breathing in an asynchronous way

Page 15: Firehose

Learnings

• You need to think asynchronous to write asynchronous code

• Dispatch internal events if you need to keep control of the flow

• “Internal queues” to scale(up to a certain limit)

Page 16: Firehose

Performance

• Beyond 5MB we start to fill the internal queue• We are limited by IO, not from CPU/memory• Consistent throughput

Page 17: Firehose

Questions ?

Page 18: Firehose

References

• npm install tail• https://github.com/forward/node-tail