Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

glow

> 编程语言
Open source

Glow is an easy-to-use distributed computation system written in Go, similar to Hadoop Map Reduce, Spark, Flink, Storm, etc. I am also working on another simila

3.2K stars0 likes0 views
WebsiteGitHub

About

Glow is an easy-to-use distributed computation system written in Go, similar to Hadoop Map Reduce, Spark, Flink, Storm, etc. I am also working on another simila

glow

Purpose

Glow is providing a library to easily compute in parallel threads or distributed to clusters of machines. This is written in pure Go.

I am also working on another pure-Go system, https://github.com/chrislusf/gleam , which is more flexible and more performant.

Installation

$ go get github.com/chrislusf/glow
$ go get github.com/chrislusf/glow/flow

One minute tutorial

Simple Start

Here is a simple full example:

package main

import (
	"flag"
	"strings"

	"github.com/chrislusf/glow/flow"
)

func main() {
	flag.Parse()

	flow.New().TextFile(
		"/etc/passwd", 3,
	).Filter(func(line string) bool {
		return !strings.HasPrefix(line, "#")
	}).Map(func(line string, ch chan string) {
		for _, token := range strings.Split(line, ":") {
			ch <- token
		}
	}).Map(func(key string) int {
		return 1
	}).Reduce(func(x int, y int) int {
		return x + y
	}).Map(func(x int) {
		println("count:", x)
	}).Run()
}

Try it.

  $ ./word_count

It will run the input text file, '/etc/passwd', in 3 go routines, filter/map/map, and then reduced to one number in one goroutine (not exactly one goroutine, but let's skip the details for now.) and print it out.

This is useful already, saving lots of idiomatic but repetitive code on channels, sync wait, etc, to fully utilize more CPU cores.

However, there is one more thing! It can run across a Glow cluster, which can be run multiple servers/racks/data centers!

Scale it out

To setup the Glow cluster, we do not need experts on Zookeeper/HDFS/Mesos/YARN etc. Just build or download one binary file.

Setup the cluster

  # Fetch and install via go, or just download it from somewhere.
  $ go get github.com/chrislusf/glow
  # Run a script from the root directory of the repo to start a test cluster.
  $ etc/start_local_glow_cluster.sh

Glow Master and Glow Agent run very efficiently. They take about 6.5MB and 5.5MB memory respectively in my environments. I would recommend set up agents on any server you can find. You can tap into the computing power whenever you need to.

Start the driver program

To leap from one computer to clusters of computers, add this line to the import list:

	_ "github.com/chrislusf/glow/driver"

And put this line as the first statement in the main() function:

	flag.Parse()

This will "steroidize" the code to run in cluster mode!

$ ./word_count -glow -glow.leader="localhost:8930"

The word_count program will become a driver program, dividing the execution into a directed acyclic graph(DAG), and send tasks to agents.

Visualize the flow

To understand how each executor works, you can visualize the flow by generating a dot file of the flow, and render it to png file via "dot" command provided from graphviz.

$ ./word_count -glow -glow.flow.plot > x.dot
$ dot -Tpng -otestSelfJoin.png x.dot

Read More

  1. Wiki page: https://github.com/chrislusf/glow/wiki
  2. Mailing list: https://groups.google.com/forum/#!forum/glow-user-discussion
  3. Examples: https://github.com/chrislusf/glow/tree/master/examples/

Docker container

Docker is not required. But if you like docker, here are instructions.

# Cross compile artefact for docker
$ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build .
# build container
$ docker build -t glow .

See examples/ directory for docker-compose setups.

Contribution

Start using it! And report or fix any issue you have seen, add any feature you want.

Fork it, code it, and send pull requests. Better first discuss about the feature you want on the mailing list. https://groups.google.com/forum/#!forum/glow-user-discussion

License

http://www.apache.org/licenses/LICENSE-2.0

GitHub Issues· 15 open

View all on GitHub
  • #94

    update instalation instructions since go get is not longer surported

    Updated Jan 12, 2023
  • #93

    feature requiest: type i to enter editor mode

    Updated Jan 3, 2023
  • #92

    Glow support for elastic search

    Updated Jul 16, 2022
  • #91

    glow run block when read big file data to mysql

    Updated Jun 2, 2022
  • #90

    Has it been used in the commercial production environment so far?

    Updated Dec 23, 2020
  • #87

    Glow support a time window like the Flink?

    Updated Aug 30, 2019
  • #4

    [feature] streaming support

    Updated Jul 19, 2019
  • #84

    Doing partial reduceByKey in Flow created in func init()

    Updated Aug 22, 2017
  • #42

    Integrate glow with Kubernetes

    Updated Jan 18, 2017
  • #8

    [feature] use github.com/DeDiS/protobuf for ser/de operations

    help wantedUpdated Nov 9, 2016

Highlights

  • •Go

> Tags

Go

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言