-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add are you alive example #5646
Changes from 1 commit
615dc52
fa96b50
ec2a1ce
0ac2441
1809bfc
05affe0
cc7ea16
86ceabe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# We are using the "dev" project in our registry for this | ||
NAME := "us.gcr.io/planetscale-dev/are-you-alive" | ||
TAG := $$(git log -1 --pretty=%H) | ||
IMG := ${NAME}:${TAG} | ||
LATEST := ${NAME}:latest | ||
|
||
.PHONY: build push | ||
|
||
build: | ||
@docker build -f build/release/Dockerfile -t ${IMG} . | ||
@docker tag ${IMG} ${LATEST} | ||
|
||
push: | ||
@docker push ${IMG} | ||
@docker push ${LATEST} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Are You Alive? | ||
|
||
What does it mean to be alive? | ||
|
||
Well we don't know what it means for you, but we know what it means for our | ||
Cloud Database! | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe delete these lines? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing from "Cloud Database" to "Vitess Cluster". |
||
This project contains a simulated client application that can be used to measure | ||
the health of a Vitess cluster over time. | ||
|
||
## Design | ||
|
||
For now, there is a specific database schema and vschema that you must apply to | ||
the database that you are using for this test. | ||
|
||
This client application: | ||
|
||
1. Hammers the database with random data (not a load test though). | ||
1. Measures all the important things: | ||
- Client connection errors | ||
- Write latency | ||
- Read latency from masters | ||
- Read latency from replicas | ||
- Write errors | ||
- Read errors on masters | ||
- Write errors on replicas | ||
- Errors in other operations on masters and replicas (e.g. COUNT) | ||
- Latency on other operations on masters and replicas (e.g. COUNT) | ||
- Data loss (by writing predictable data and testing for that) | ||
1. Reports all these metrics to Prometheus. | ||
|
||
That's it! Keep it as simple and generic as possible, and someday our customers | ||
can use this to test their clusters too! | ||
|
||
sverch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Usage | ||
|
||
First, [initialize your database with the correct schemas](schemas/README.md). | ||
|
||
Run `are-you-alive --help` for usage. You can us the command line flags to | ||
control the dataset size, whether to target reads at masters and replicas, your | ||
mysql connection string, and the rate at which to send requests. | ||
|
||
Example: | ||
|
||
``` | ||
./are-you-alive --mysql_connection_string <mysql_connection_string> | ||
``` | ||
|
||
Where `<mysql_connection_string>` points to the database you are trying to test, | ||
and everything else will be set to defaults. | ||
|
||
## Building | ||
|
||
``` | ||
dep ensure -v | ||
go build github.com/planetscale/are-you-alive/cmd/are-you-alive | ||
``` | ||
|
||
## Testing | ||
|
||
First, [install docker compose](https://docs.docker.com/compose/install/) and | ||
make sure it's working. Then run: | ||
|
||
``` | ||
dep ensure -v | ||
docker-compose build | ||
docker-compose up | ||
``` | ||
|
||
This will create a local mysqld and a local prometheus to scrape the app. It | ||
will also start the app with the `--initialize` flag which tells it to | ||
automatically create the test database. You might have to run this twice to | ||
give mysql a chance to do its first initialization. | ||
|
||
After you run docker compose, navigate to `http://localhost:9090` to see | ||
Prometheus and `http://localhost:8080/metrics` to see the raw metrics being | ||
exported. | ||
|
||
## Push to Registry | ||
|
||
``` | ||
make build | ||
make push | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to include this? most people won't have the necessary access. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add a note about access here, but I think documenting the commands makes sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
us.gcr.io/planetscale-vitess/are-you-alive
. Does that sound good to you @dctrwatson?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is meant for public consumption, yes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, updated, but now I need to fix the build.