microsvcgotools

module
v0.0.0-...-c2e3ddf Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: MIT

README

microsvcgotools

Run the panicking app

Run the following to compare the output with and without panicparse.

go run ./boom/cmd/main.go #without panicparse
go run ./boom/cmd/main.go 2>&1 | pp

Run and manually test gRPC server with gRPCurl

The fizzbuzz package contains a server that exposes a gRPC endpoint for getting "fizzbuzz" values for numbers in a certain interval.

Use gRPCurl to hit the endpoint without writing a gRPC client.

# Run the gRPC server
go run ./fizzbuzz/grpc/main.go
# Hit the gRPC server endpoint with JSON
grpcurl -proto fizzbuzz/fizzbuzz.proto -plaintext -d '{"start": 1, "end": 100}' localhost:1234 fizzbuzz.FizzBuzz/GetFizzBuzzSequence

# Simplify this by creating a temporary alias:
alias grpcall="grpcurl -proto fizzbuzz/fizzbuzz.proto -plaintext -d @ localhost:1234 fizzbuzz.FizzBuzz/GetFizzBuzzSequence"
# Then simply:
echo '{"start": 0, "end": 100}' | grpcall
Manually test through a web interface

Take gRPCurl a step further and get a nice web UI with gRPCui.

# Start a web UI for hitting the same server (works because reflection is enabled)
grpcui -plaintext localhost:1234
Load test the gRPC server with ghz

Use ghz to load test your gRCP server.

ghz \
--insecure \
-d '{"start": 1, "end": 600}' \
-c 100 \
-n 5000 \
--call=fizzbuzz.FizzBuzz/GetFizzBuzzSequence \
--connections=5 \
localhost:1234
Generate and explore the gRPC server under load

Assuming you have built and are running the binary main (built from ./fizzbuzz/grpc/main.go), run pprof to get profile your application. You probably want to use ghz to generate some load so your application isn't idle.

go tool pprof -http=":" main http://localhost:4321/debug/pprof/profile

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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