• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Distributed long running work system in Go

metafora

Join the chat at https://gitter.im/lytics/metafora Build Status GoDoc

Metafora is a Go library designed to run long-running (minutes to permanent) tasks in a cluster.

IRC: #lytics/metafora on irc.gitter.im

Features

  • Distributed - horizontally scalable
  • Elastic - online cluster resizing with automated rebalancing
  • Masterless - work stealing, not assigning, pluggable balancing
  • Fault tolerant - tasks are reassigned if nodes disappear
  • Simple - few states, no checkpointing, no configuration management
  • Extensible - well defined interfaces for implementing balancing and coordinating
  • Exactly-once - designed to enforce one-and-only-one instance of each submitted task is runningref

Metafora is a library for building distributed task work systems. You're responsible for creating a main() entrypoint for your application, writing a metafora.Handler and HandlerFunc to actually process tasks, and then starting Metafora's Consumer.

Metafora's task state machine is implemented as a Handler adapter. Simply implement your task processor as a StatefulHandler function, and create a metafora.Handler with statemachine.New.

Example

koalemosd is a sample consumer implementation that can be run as a daemon (it requires etcd). koalemosctl is a sample command line client for submitting tasks to koalemosd.

# Install etcd as per https://go.etcd.io/etcd#getting-etcd
# Run the following in one terminal:
go get -v -u github.com/lytics/metafora/examples/koalemosd
koalemosd

# Run the client in another
go get -v -u github.com/lytics/metafora/examples/koalemosctl
koalemosctl sleep 3 # where "sleep 3" is any command on your $PATH

Since koalemosd is a simple wrapper around OS processes, it does not use the state machine (statemachine.StatefulHandler).

Terms

BalancerGo interface consulted by Consumer for determining which tasks can be claimed and which should be released. See balancer.go.
Brokerexternal task and command store like etcd for the Coordinator to use.
Consumercore work runner. Integrates Balancer, Coordinator, and Handlers to get work done.
Coordinatorclient Go interface to Broker. See coordinator.go.
HandlerGo interface for executing tasks.
Taskunit of work. Executed by Handlers.

FAQ

Q. Is it ready for production use?

Yes. Metafora with the etcd coordinator has been the production work system at Lytics since January 2014 and runs thousands of tasks concurrently across a cluster of VMs.

Since Metafora is still under heavy development, you probably want to pin the dependencies to a commit hash or tag to keep the API stable. The master branch is automatically tested and is safe for use if you can tolerate API changes.

Q. Where is the metaforad daemon?

It doesn't exist. Metafora is library for you to import and use in a service you write. Metafora handles task management but leaves implementation details such as task implementation and daemonization up to the user.

FAQ continued in Documentation...

More Repositories

1

anomalyzer

Probabilistic anomaly detection for time series data
Go
292
star
2

confl

Config parser for go, modeled after Nginx format, Nice lenient syntax with Comments
Go
139
star
3

cloudstorage

Cloud & local storage unified api (s3, google, azure, sftp, local)
Go
80
star
4

multibayes

Multiclass Naive Bayesian Classification
Go
76
star
5

grid

A library for distributed processing for Go
Go
57
star
6

hll

HyperLogLog++ for Go
Go
43
star
7

base62

base62 (ie, url safe) encoding golang lib
Go
42
star
8

escp

Elasticsearch Copier - Copies ES indexes
Go
40
star
9

impact

Lightweight bootstrap testing for detecting causal impact to timeseries in Go.
Go
17
star
10

lytics

Lytics Command Line Utility
Go
15
star
11

dfa

Deterministic Finite Automata to define computation with labeled states and explicit transitions
Go
13
star
12

cache

In memory concurrent cache data structure for go (golang)
Go
9
star
13

sereno

Sereno is a Go library of recipes for Etcd. Inspired by Netflix's curator for Zookeeper.
Go
9
star
14

toolbucket

A selection of small Go tool kits for anyone to use.
Go
8
star
15

squaredance

Simple task coordination
Go
7
star
16

slackhook

Simple Go client for Slack's Incoming WebHook API
Go
7
star
17

sshtail

Simple utility to multiplex logs from multiple servers over SSH
Go
6
star
18

sample

Weighted sampling in Go
Go
6
star
19

estail

Elasticsearch/Logstash Tailing Tool
Go
5
star
20

qlbridge

A golang expression evaluator & Library to build SQL query engine based functionality.
Go
5
star
21

gowrapmx4j

Golang wrapper for accesssing MX4J HTTP data
Go
5
star
22

go-lytics

Lytics SDK for Go (Golang)
Go
5
star
23

collector-ios

Ios Collector SDK for lytics.io
Objective-C
5
star
24

datemath

Simple library for evaluating ElasticSearch style date expressions.
Go
4
star
25

ordpool

An order-preserving parallel worker pool library for Go
Go
4
star
26

retry

Retry Library for Go
Go
3
star
27

wherefore

Wherefore art thy transferring via network?
Go
3
star
28

inflight

inflight provides primitives for managing sets of inflight messages that are being processed in parallel
Go
3
star
29

LogspoutLoges

A gliderlabs/logspout module for shipping logs straight to Elasticsearch to bypass the necessity for Logstash.
Go
3
star
30

informant

A drop-in solution for visualizing metrics
JavaScript
3
star
31

gentleman

Full-featured, plugin-oriented, composable HTTP client toolkit for Go
Go
3
star
32

pathforajs

Web personalization SDK
JavaScript
2
star
33

lifecycle

Go package that helps with managing service states and shutdown requests
Go
2
star
34

flo

Pre Alpha
Go
2
star
35

gobyairship

Go client for Urban Airship
Go
2
star
36

skewer

Dumb tool for detecting skew between dumb cloud clocks
Go
2
star
37

rgcs

Google Cloud Storage Wrapper for R
R
2
star
38

pathforacss

Boilerplate for generating custom PathforaJS styles.
CSS
2
star
39

analyst

A simple data API abstraction layer
JavaScript
1
star
40

lytics-js

Interact with the Lytics REST API from JavaScript
TypeScript
1
star
41

pathforadocs

HTML
1
star
42

saltfiles

Public Salt-States for lytics, and custom grains, modules, etc
Python
1
star
43

toomanysecrets

Private gist cleaner
Go
1
star
44

pathforajs-examples

1
star
45

quickstart

Quickstart For getting up and running building Visualizations using Lytics.io
JavaScript
1
star
46

etcdlog

Logs etcd events
Go
1
star
47

ghmoveproject

CLI app to move github project from a repo to an org
Go
1
star
48

segml

A dashboard for creating and visualizing Lytics SegmentML models
R
1
star