consistenthash

command
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Distributed Build with Consistent Hashing

Demo for efficiently using Shipyard daemon-local cache with multi-node cluster

Deploy

$ kubectl apply -f ../statefulset.rootless.yaml
$ kubectl scale --replicas=10 statefulset/shipyard

Consistent hashing

Define the key string for consistent hashing.

For example, the key can be defined as <REPO NAME>:<CONTEXT PATH>, e.g. github.com/example/project:some/directory.

Then determine the pod that corresponds to the key:

$ go build -o consistenthash .
$ pod=$(./show-running-pods.sh | consistenthash $key)

You can connect to the pod using export SHIPYARD_HOST=kube-pod://$pod.

Documentation

Overview

Package main provides simple consistenthash commandline utility.

Demo:

$ seq -f node-%.f 1 100 > /tmp/nodes
$ consistenthash < /tmp/nodes apple
node-42
$ consistenthash < /tmp/nodes banana
node-48
$ consistenthash < /tmp/nodes chocolate
node-2

Modify /tmp/nodes and confirm that the result rarely changes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL