Skip to content

Library support for working with process & distributed system in Elixir

License

Notifications You must be signed in to change notification settings

ohhi-vn/super_worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

The library support for auto scale & distritubed for Elixir application. Help dev can easily work with concurrency.

Note: Library is still developing, please don't use for product.

Guide

Just declare function for worker (task) and input (in param or stream) and run. Library is created for dev can add workers in runtime without care too much about design supervisor tree. It's matched with dynamic typed language like Elixir.

Features

Support new kind of process, chain processes is made for easy create a powerful stream processing.

Supervisor

Support three type of processes in one supervisor. Can declare by config or add in runtime.

graph LR
Client(Client) <-->|api| Supervisor
    Supervisor--> Group_1
    Supervisor--> Chain_1
    Supervisor-->Worker_standalone1
    Supervisor-->Worker_standalone2
    Group_1-->Worker_g1
    Group_1-->Worker_g2
    Group_1-->Worker_g3
    Chain_1-->Worker_c1
    Worker_c1-->Worker_c2
    Worker_c2-->Worker_c3
Loading

Type of processes:

  • Group processes
  • Chain processes
  • Freedom processes

Group processes

All processes in supervisor have same group_id. If a process in group is crashed, all other processes will be died follow. Avoid using trap_exit in process to avoid side effect.

Support send message to worker or broadcast to all workers in a group. Dev don't need to implement a way for transfer data to worker.

graph LR
    Group_1-->Worker_1
    Group_1-->Worker_2
    Group_1-->Worker_3
Loading

Chain processes

Support chain task type. The data after process in a process will be passed to next process in chain. If a process is crashed, all other process in chain will be die follow.

From foreign process data can pass to chain (first worker in chain or directly to a worker with id) by Supervisor APIs.

Can config function to call in the end of chain or self implement code in the last worker in the chain.

graph LR
    Worker_c1-->Worker_c2
    Worker_c2-->Worker_c3
Loading

Standalone processes

This for standalone worker run in supervisor, it has owner restart strategy. If a standalone worker is crashed, it doesn't affect to other standalone workers or workers in group/chain.

graph LR
    Supervisor-->Worker_standalone1
    Supervisor-->Worker_standalone2
    Supervisor-->Worker_standalone3
Loading

Planned features

  • Support GenServer.
  • Callback module for easy understand & implement.
  • Multiprocess per chain node.
  • Auto scale for chain.
  • Distributed in cluster.

About

Library support for working with process & distributed system in Elixir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages