Giter Club home page Giter Club logo

gen_stage's Introduction

GenStage

GenStage is a specification for exchanging events between producers and consumers. It also provides a mechanism to specify the computational flow between stages.

This project currently provides the following functionality:

  • Experimental.GenStage (docs) - a behaviour for implementing producer and consumer stages

  • Experimental.Flow (docs) - Flow allows developers to express computations on collections, similar to the Enum and Stream modules, although computations will be executed in parallel using multiple GenStages

  • Experimental.DynamicSupervisor (docs) - a supervisor designed for starting children dynamically. Besides being a replacement for the :simple_one_for_one strategy in the regular Supervisor, a DynamicSupervisor can also be used as a stage consumer, making it straight-forward to spawn a new process for every event in a stage pipeline

The module names are marked as Experimental to avoid conflicts as they are meant to be included in future Elixir releases. In your code, you may add alias Experimental.{DynamicSupervisor, GenStage} to the top of your files and use the relative names from then on.

You can find examples on how to use the modules above in the examples directory:

  • ProducerConsumer - a simple example of setting up a pipeline of A -> B -> C stages and having events flowing through

  • DynamicSupervisor - an example of how to use one or more DynamicSupervisor as a consumer to a producer that works as a counter

  • GenEvent - an example of how to use GenStage to implement a GenEvent replacement that leverages concurrency and provides more flexibility regarding buffer size and back-pressure

Installation

GenStage requires Elixir v1.3.

  1. Add :gen_stage to your list of dependencies in mix.exs:

    def deps do [{:gen_stage, "~> 0.4"}] end

  2. Ensure :gen_stage is started before your application:

    def application do [applications: [:gen_stage]] end

Future research

Here is a list of potential topics to be explored by this project (in no particular order or guarantee):

  • Consider using DynamicSupervisor to implement Task.Supervisor (as a consumer)

  • TCP and UDP acceptors as producers

  • Explore different windowing strategies - the ideas behind the Apache Beam project are interesting, specially the mechanism that divides operations between what/where/when/how (1, 2) as well as windowing from the perspective of aggregation (3)

Other research topics include the Titan (4), Naiad's Differential Dataflow engine (5) and Lasp (6).

Links

  1. https://cloud.google.com/blog/big-data/2016/05/why-apache-beam-a-google-perspective
  2. http://www.vldb.org/pvldb/vol8/p1792-Akidau.pdf
  3. http://www.vldb.org/pvldb/vol8/p702-tangwongsan.pdf
  4. http://asc.di.fct.unl.pt/~nmp/pubs/clouddp-2013.pdf
  5. http://research-srv.microsoft.com/pubs/176693/differentialdataflow.pdf
  6. https://lasp-lang.org/

License

Same as Elixir.

gen_stage's People

Contributors

fishcakez avatar josevalim avatar foo42 avatar ericentin avatar whatyouhide avatar austinsmorris avatar chrrasmussen avatar lmarlow avatar mkompanets avatar millionintegrals avatar mitchellhenke avatar thewazir avatar ronanh avatar sanrodari avatar stevedomin avatar ma2gedev avatar thbar avatar

Watchers

James Cloos 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.