GithubHelp home page GithubHelp logo

alexxnica / emojitrack-nodestreamer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emojitracker/emojitrack-nodestreamer

0.0 1.0 0.0 365 KB

:dizzy: NodeJS implementation of emojitrack-streamer

CoffeeScript 95.61% JavaScript 4.39%

emojitrack-nodestreamer's Introduction

emojitrack-nodestreamer

Build Status

First stab at experimental standalone replacement for emojitrack SSE streaming web services, using node evented methods rather than MRI ruby with threads. While the Ruby version was written in spaghetti-land while I had no idea what I was doing, this version was written from scratch after understanding the problem domain well. Thus, it's significantly better structured, has some unit tests, and should be better code in general overall.

This should be API compatible with the MRI version. (In fact, we're load balancing 50% of clients to each right now to test in production.) For a full explanation of the responsibilities of this system and it's API, see the README for mroth/emojitrack-streamer-spec.

The first stab at this was actually slower (albeit most consistent), so now experimenting with cluster workers to try to take advantage of multiple CPU cores to match ruby speed...

Feature differences from Ruby version

  • No handling of downgraded connection-close if needed, requires a fully working routing environment (should be good only with new routing layer on Heroku and labs:websockets enabled)
  • No handling of interactive kiosk-mode streams, left out for now for time savings since they aren't in active use until we have another emojitracker physical installation.
  • No implementation of logging to graphite yet (again, waiting until we know we want to use this as the primary streamer in production.)

Discussion

  • The first stab at this is in server-sse.coffee.
  • There is a revised multi-process version in server-cluster.coffee.
    It attempts to distribute the load of clients across numCpus-1 forked processes, while preserving a core for the master process to handle reading from Redis and doing the ScorePacker rollup messages.

It's unclear why this isn't more significantly faster than the naive MRI implementation. This is almost pure IO and event handling, which NodeJS should excel at. There is some low hanging fruit in terms of redundant String operations, but nothing that should account for much CPU usage (and fixing those things proved to show no real difference in benchmarking, so I left them out to try to find the real critical paths.)

Benchmarks coming soon.

TODO:

  • logging
  • admin interface reporting
  • add newrelic reporting
  • performance profiling vs ruby threads solution
  • legacy graphite reporting?

emojitrack-nodestreamer's People

Contributors

mroth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.