From 3fcb62b93107c17679047edcd87fc5020b197f6a Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 9 Oct 2018 18:04:15 +0400 Subject: [PATCH] :tools: Update docs & fix build-docker Makefile target (#2584) bump alpine version to 3.8 --- tools/tm-bench/Dockerfile | 2 +- tools/tm-bench/Makefile | 4 +- tools/tm-bench/README.md | 85 ++++++++++++++++++++++++------------- tools/tm-monitor/Dockerfile | 2 +- tools/tm-monitor/Makefile | 4 +- tools/tm-monitor/README.md | 75 +++++++++++++++++++------------- 6 files changed, 106 insertions(+), 66 deletions(-) diff --git a/tools/tm-bench/Dockerfile b/tools/tm-bench/Dockerfile index 9adb2936e..d1069643a 100644 --- a/tools/tm-bench/Dockerfile +++ b/tools/tm-bench/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.7 +FROM alpine:3.8 WORKDIR /app COPY tm-bench /app/tm-bench diff --git a/tools/tm-bench/Makefile b/tools/tm-bench/Makefile index 79aaf0c99..8a395f98f 100644 --- a/tools/tm-bench/Makefile +++ b/tools/tm-bench/Makefile @@ -1,5 +1,5 @@ DIST_DIRS := find * -type d -exec -VERSION := $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' main.go) +VERSION := $(shell perl -ne '/^TMCoreSemVer = "([^"]+)"$$/ && print "v$$1\n"' ../../version/version.go) all: build test install @@ -37,7 +37,7 @@ dist: build-all build-docker: rm -f ./tm-bench - docker run -it --rm -v "$(PWD):/go/src/app" -w "/go/src/app" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-s -w" -o tm-bench + docker run -it --rm -v "$(PWD)/../../:/go/src/github.com/tendermint/tendermint" -w "/go/src/github.com/tendermint/tendermint/tools/tm-bench" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-s -w" -o tm-bench docker build -t "tendermint/bench" . clean: diff --git a/tools/tm-bench/README.md b/tools/tm-bench/README.md index 000f20f37..9159a7546 100644 --- a/tools/tm-bench/README.md +++ b/tools/tm-bench/README.md @@ -4,49 +4,72 @@ Tendermint blockchain benchmarking tool: - https://github.com/tendermint/tools/tree/master/tm-bench -For example, the following: - - tm-bench -T 10 -r 1000 localhost:26657 +For example, the following: `tm-bench -T 30 -r 10000 localhost:26657` will output: - Stats Avg StdDev Max Total - Txs/sec 818 532 1549 9000 - Blocks/sec 0.818 0.386 1 9 +``` +Stats Avg StdDev Max Total +Txs/sec 3981 1993 5000 119434 +Blocks/sec 0.800 0.400 1 24 +``` +NOTE: **tm-bench only works with build-in `kvstore` ABCI application**. For it +to work with your application, you will need to modify `generateTx` function. +In the future, we plan to support scriptable transactions (see +[\#1938](https://github.com/tendermint/tendermint/issues/1938)). ## Quick Start +### Docker + +``` +docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init +docker run -it --rm -v "/tmp:/tendermint" -p "26657:26657" --name=tm tendermint/tendermint node --proxy_app=kvstore + +docker run -it --rm --link=tm tendermint/bench tm:26657 +``` + +### Using binaries + [Install Tendermint](https://github.com/tendermint/tendermint#install) -This currently is setup to work on tendermint's develop branch. Please ensure -you are on that. (If not, update `tendermint` and `tmlibs` in gopkg.toml to use - the master branch.) then run: - tendermint init - tendermint node --proxy_app=kvstore +``` +tendermint init +tendermint node --proxy_app=kvstore - tm-bench localhost:26657 +tm-bench localhost:26657 +``` -with the last command being in a seperate window. +with the last command being in a separate window. ## Usage - tm-bench [-c 1] [-T 10] [-r 1000] [-s 250] [endpoints] - - Examples: - tm-bench localhost:26657 - Flags: - -T int - Exit after the specified amount of time in seconds (default 10) - -c int - Connections to keep open per endpoint (default 1) - -r int - Txs per second to send in a connection (default 1000) - -s int - Size per tx in bytes - -v Verbose output +``` +Tendermint blockchain benchmarking tool. + +Usage: + tm-bench [-c 1] [-T 10] [-r 1000] [-s 250] [endpoints] [-output-format [-broadcast-tx-method ]] + +Examples: + tm-bench localhost:26657 +Flags: + -T int + Exit after the specified amount of time in seconds (default 10) + -broadcast-tx-method string + Broadcast method: async (no guarantees; fastest), sync (ensures tx is checked) or commit (ensures tx is checked and committed; slowest) (default "async") + -c int + Connections to keep open per endpoint (default 1) + -output-format string + Output format: plain or json (default "plain") + -r int + Txs per second to send in a connection (default 1000) + -s int + The size of a transaction in bytes, must be greater than or equal to 40. (default 250) + -v Verbose output +``` ## How stats are collected @@ -72,9 +95,11 @@ that tm-bench sends. Similarly the end of the duration will likely end mid-way through tendermint trying to build the next block. -Each of the connections is handled via two separate goroutines. +Each of the connections is handled via two separate goroutines. ## Development - make get_vendor_deps - make test +``` +make get_vendor_deps +make test +``` diff --git a/tools/tm-monitor/Dockerfile b/tools/tm-monitor/Dockerfile index 7edfaca66..930fb639e 100644 --- a/tools/tm-monitor/Dockerfile +++ b/tools/tm-monitor/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.6 +FROM alpine:3.8 WORKDIR /app COPY tm-monitor /app/tm-monitor diff --git a/tools/tm-monitor/Makefile b/tools/tm-monitor/Makefile index 077d60b94..901b0a14d 100644 --- a/tools/tm-monitor/Makefile +++ b/tools/tm-monitor/Makefile @@ -1,5 +1,5 @@ DIST_DIRS := find * -type d -exec -VERSION := $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' main.go) +VERSION := $(shell perl -ne '/^TMCoreSemVer = "([^"]+)"$$/ && print "v$$1\n"' ../../version/version.go) all: build test install @@ -36,7 +36,7 @@ dist: build-all build-docker: rm -f ./tm-monitor - docker run -it --rm -v "$(PWD):/go/src/github.com/tendermint/tools/tm-monitor" -w "/go/src/github.com/tendermint/tools/tm-monitor" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-s -w" -o tm-monitor + docker run -it --rm -v "$(PWD)/../../:/go/src/github.com/tendermint/tendermint" -w "/go/src/github.com/tendermint/tendermint/tools/tm-monitor" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-s -w" -o tm-monitor docker build -t "tendermint/monitor" . clean: diff --git a/tools/tm-monitor/README.md b/tools/tm-monitor/README.md index 4c49775e3..cf4216849 100644 --- a/tools/tm-monitor/README.md +++ b/tools/tm-monitor/README.md @@ -12,18 +12,22 @@ collecting and providing various statistics to the user: Assuming your application is running in another container with the name `app`: - docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init - docker run -it --rm -v "/tmp:/tendermint" -p "26657:26657" --name=tm --link=app tendermint/tendermint node --proxy_app=tcp://app:26658 +``` +docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init +docker run -it --rm -v "/tmp:/tendermint" -p "26657:26657" --name=tm --link=app tendermint/tendermint node --proxy_app=tcp://app:26658 - docker run -it --rm -p "26670:26670" --link=tm tendermint/monitor tm:26657 +docker run -it --rm -p "26670:26670" --link=tm tendermint/monitor tm:26657 +``` If you don't have an application yet, but still want to try monitor out, use `kvstore`: - docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init - docker run -it --rm -v "/tmp:/tendermint" -p "26657:26657" --name=tm tendermint/tendermint node --proxy_app=kvstore +``` +docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init +docker run -it --rm -v "/tmp:/tendermint" -p "26657:26657" --name=tm tendermint/tendermint node --proxy_app=kvstore - docker run -it --rm -p "26670:26670" --link=tm tendermint/monitor tm:26657 +docker run -it --rm -p "26670:26670" --link=tm tendermint/monitor tm:26657 +``` ### Using Binaries @@ -31,40 +35,49 @@ use `kvstore`: then run: - tendermint init - tendermint node --proxy_app=kvstore +``` +tendermint init +tendermint node --proxy_app=kvstore - tm-monitor localhost:26657 +tm-monitor localhost:26657 +``` -with the last command being in a seperate window. +with the last command being in a separate window. ## Usage - tm-monitor [-v] [-no-ton] [-listen-addr="tcp://0.0.0.0:26670"] [endpoints] +``` +Tendermint monitor watches over one or more Tendermint core +applications, collecting and providing various statistics to the user. - Examples: - # monitor single instance - tm-monitor localhost:26657 +Usage: + tm-monitor [-no-ton] [-listen-addr="tcp://0.0.0.0:26670"] [endpoints] - # monitor a few instances by providing comma-separated list of RPC endpoints - tm-monitor host1:26657,host2:26657 - Flags: - -listen-addr string - HTTP and Websocket server listen address (default "tcp://0.0.0.0:26670") - -no-ton - Do not show ton (table of nodes) - -v verbose logging +Examples: + # monitor single instance + tm-monitor localhost:26657 + + # monitor a few instances by providing comma-separated list of RPC endpoints + tm-monitor host1:26657,host2:26657 +Flags: + -listen-addr string + HTTP and Websocket server listen address (default "tcp://0.0.0.0:26670") + -no-ton + Do not show ton (table of nodes) +``` ### RPC UI Run `tm-monitor` and visit http://localhost:26670 You should see the list of the available RPC endpoints: - http://localhost:26670/status - http://localhost:26670/status/network - http://localhost:26670/monitor?endpoint=_ - http://localhost:26670/status/node?name=_ - http://localhost:26670/unmonitor?endpoint=_ +``` +http://localhost:26670/status +http://localhost:26670/status/network +http://localhost:26670/monitor?endpoint=_ +http://localhost:26670/status/node?name=_ +http://localhost:26670/unmonitor?endpoint=_ +``` The API is available as GET requests with URI encoded parameters, or as JSONRPC POST requests. The JSONRPC methods are also exposed over @@ -72,6 +85,8 @@ websocket. ## Development - make get_tools - make get_vendor_deps - make test +``` +make get_tools +make get_vendor_deps +make test +```