Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meadsteve/chaos-spawn
☄️ Chaotic spawning for elixir
https://github.com/meadsteve/chaos-spawn
Last synced: 17 days ago
JSON representation
☄️ Chaotic spawning for elixir
- Host: GitHub
- URL: https://github.com/meadsteve/chaos-spawn
- Owner: meadsteve
- License: mit
- Created: 2015-09-29T08:30:20.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-14T12:08:26.000Z (about 6 years ago)
- Last Synced: 2024-10-11T03:11:12.304Z (about 1 month ago)
- Language: Elixir
- Homepage:
- Size: 90.8 KB
- Stars: 88
- Watchers: 8
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Chaos Spawn
==========
[![Build Status](https://travis-ci.org/meadsteve/chaos-spawn.svg?branch=master)](https://travis-ci.org/meadsteve/chaos-spawn)## What and why
Inspired by netfix's chaos monkey. This library is intended to be a low level
process based equivalent. It works by storing a list of procceses that are periodically terminated at random. Helper modules are provided to make it easy to register proceses as ones that can be killed. The intention is that this should force the design of an app's supervision tree to actually work.This is still fairly early alpha work. So please test before adding to any live projects you may have.
## Installation
Add the following to your mix.exs dependencies:
```elixir
defp deps do
[ {:chaos_spawn, "~> 0.3.0"} ]
end
```
then add chaos_spawn as an application in your mix.exs:```elixir
def application do
[applications: [:logger, :chaos_spawn]]
end
```## Usage
### Control
The moment the app is started chaos spawn starts potential killing processes.
This can be stopped by calling
```elixir
ChaosSpawn.stop
```
and then later restarted with:
```elixir
ChaosSpawn.start
```### Registering processes to kill
By default no processes are eligible to be killed by chaos spawn. The
following documents show how to do this:[HOWTO: Add chaos spawn using the provided helper modules](usage-automatic.md)
[HOWTO: Add chaos spawn manually](usage-manual.md)
### Example
An example of using this with the phoenix web framework can be found here:
https://github.com/meadsteve/chaos-spawn-example### Config
A number of options are provided:
#### ```kill_tick```
The delay in milliseconds between chaos spawn checking for processes to kill.
#### ```kill_probability```
A float between 0 and 1 that determines the probability of a process being
killed each tick.
#### ```only_kill_between```
Takes a start and end time (always utc) and chaos spawn will only kill
processes between these times.```elixir
config :chaos_spawn, :kill_tick, 1000
config :chaos_spawn, :kill_probability, 0.1
config :chaos_spawn, :only_kill_between, {{10, 00, 00}, {16, 00, 00}}
```## Contributing
Contributions to this repo are more than welcome. Guidlines for succesfull PRs:
* Any large changes should ideally be opened as an issue first so a disucssion can be had.
* Code should be tested.
* Code under ```lib/``` should conform to coding standards tested by https://github.com/lpil/dogma . You can test this by running ```mix dogma lib/```