Code Monkey home page Code Monkey logo

cluster-file-writer's Introduction

Cluster file writer

This writter attemps to manage two backpressures / bottlenecks in a master / worker scenario where many workers send data to the master to be written to a file.

The first bottleneck is on the file written by the master and it is handled by sending a pause / resume message back to the workers, mimicing a normal stream backpressure behavior.

The second is backpressure from the underlying stream between each worker and master (Assuming the workers pump a lot of data to the master). Unfortunately there is no 'drain' event for communication channel used between the worker and the master (AFAIK it is not properly exposed), so this module tries its best to mimic it using timers.

###Install

npm install cluster-file-writer

###usage

in master

	var ClusterFileWriter = require('../lib/ClusterFileWriter');
	var master = new ClusterFileWriter.Master('test.log');

in worker

	var ClusterFileWriter = require('../lib/ClusterFileWriter');

	var worker = new ClusterFileWriter.Worker();

	worker.write('yey!');

Data integrity tests are included

###TODO: File name change mid flight needs a test

Backpressure in scenario where master pumps a lot of data to workers

Rewrite tests with mocha

Worker death tests need to be perfected

cluster-file-writer's People

Contributors

kessler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.