1
0
mirror of https://github.com/helm/chartmuseum.git synced 2026-02-05 15:45:50 +01:00
Files
chartmuseum/Makefile
David Genest 0e9d2e36ea Optimized index regeneration
Index regeneration before this PR was causing a concurrency pile-up when
many requests were coming in at a fast pace.  This was causing the time
to return /index to always increase. The behavior was observed on a high
latency connection to Google Cloud Storage, but would also occur with
other network stores.

With this PR, the regeneration time is constant and thus the serving of
index.yaml is also constant.

The implementation takes a general approach to first make initial
network requests (to satisfy the object list from storage) and to pile
up subsequent requests while the initial one is being completed. The
same algorithm is used to update the in-memory cached index.  Note that
these requests need not be protected by a lock because they are only
ever executing on their own. See server.getChartList() for the
implementaion of this idea.

A refactor was needed to separate the fetch from the diff calculation to
allow separate calling of the network heavy operations. While doing so,
we also removed redundant calls to storage file list update.

Also made small low-hanging fruit style optimisations to index
manipulations.

Added request ID to all requests for better debugging. This will be
visible with the --debug flag. This was indispensable to diagnose
complex concurrent processing.

To test the before and after state, we have added the use of the
locusti.io loadtesting engine. A simple README in the loadtesting/
directory shows how to install locust (with pipenv) and loadtest
chartmuseum. This will prove useful in the future.

Fixes #18
2017-11-16 16:15:43 -05:00

96 lines
2.4 KiB
Makefile

# Change this and commit to create new release
VERSION=0.2.4
REVISION := $(shell git rev-parse --short HEAD;)
HAS_GLIDE := $(shell command -v glide;)
HAS_PIP := $(shell command -v pip;)
HAS_VENV := $(shell command -v virtualenv;)
HAS_GOVIZ := $(shell command -v goviz;)
HAS_DOT := $(shell command -v dot;)
HAS_AWS := $(shell command -v aws;)
.PHONY: bootstrap
bootstrap:
ifndef HAS_GLIDE
@go get -u github.com/Masterminds/glide
endif
@glide install --strip-vendor
.PHONY: build
build: build_linux build_mac build_windows
build_windows: export GOARCH=amd64
build_windows:
@GOOS=windows go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
-o bin/windows/amd64/chartmuseum cmd/chartmuseum/main.go # windows
build_linux: export GOARCH=amd64
build_linux: export CGO_ENABLED=0
build_linux:
@GOOS=linux go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
-o bin/linux/amd64/chartmuseum cmd/chartmuseum/main.go # linux
build_mac: export GOARCH=amd64
build_mac: export CGO_ENABLED=0
build_mac:
@GOOS=darwin go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
-o bin/darwin/amd64/chartmuseum cmd/chartmuseum/main.go # mac osx
.PHONY: clean
clean:
@git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf
.PHONY: setup-test-environment
setup-test-environment:
ifndef HAS_PIP
@sudo apt-get update && sudo apt-get install -y python-pip
endif
ifndef HAS_VENV
@sudo pip install virtualenv
endif
@./scripts/setup_test_environment.sh
.PHONY: test
test: setup-test-environment
@./scripts/test.sh
.PHONY: testcloud
testcloud: export TEST_CLOUD_STORAGE=1
testcloud: test
.PHONY: covhtml
covhtml:
@go tool cover -html=.cover/cover.out
.PHONY: acceptance
acceptance: setup-test-environment
@./scripts/acceptance.sh
.PHONY: run
run:
@rm -rf .chartstorage/
@bin/darwin/amd64/chartmuseum --debug --port=8080 --storage="local" \
--storage-local-rootdir=".chartstorage/"
.PHONY: tree
tree:
@tree -I vendor
# https://github.com/hirokidaichi/goviz/pull/8
.PHONY: goviz
goviz:
ifndef HAS_GOVIZ
@go get -u github.com/RobotsAndPencils/goviz
endif
ifndef HAS_DOT
@sudo apt-get update && sudo apt-get install -y graphviz
endif
@goviz -i github.com/kubernetes-helm/chartmuseum/cmd/chartmuseum -l | dot -Tpng -o goviz.png
.PHONY: release
release:
ifndef HAS_AWS
@sudo pip install awscli
endif
@scripts/release.sh $(VERSION)