Simple gRPC binary for hello message "ping pong"
86
This can be used to simulate traffic. The dynamic interval settings can simulate different network congestions in distributed systems.
To visualize network traffic you could use Kiali or Jaeger.
If you run in Kubernetes you can scale with the autoscaler (for the servers) or "--replicas" (for the clients) until your hardware breaks (you can always scale horizontally e.g. on bare-metal or with docker compose). On large Kubernetes clusters (or large server fleets in general) I would recommend to start multiple servers and hundreds of clients (with different intervals).
There is a default config file at /config.yml that looks as follows:
simple-grpc:
settings:
listenport: 8080
interval: 1s
target: 127.0.0.1:9090
message: Hi from a simple gRPC client!
answer: Hi from a simple gRPC server!
runtype: client
You can overwrite the file with your settings by mounting your own config.yml to /config.yml.
e.g. you can write your own myconfig.yml and run a command from the respective directory:
docker run --rm -it --mount type=bind,source="$(realpath myconfig.yml)",target="/config.yml" hyrsh/simplegrpc:1.0
The "runtype" property dictates how the image behaves:
The "interval" is a parsed GoLang duration string (time.ParseDuration) in a form like "1s", "150ms", "25m", "1d".
Deploy a client with:
kubectl apply -f https://raw.githubusercontent.com/hyrsh/simplegrpc/main/kubernetes/simplegrpc-client-deploy.yml
Deploy a server with:
kubectl apply -f https://raw.githubusercontent.com/hyrsh/simplegrpc/main/kubernetes/simplegrpc-server-deploy.yml
The deployments will be able to connect to each other when running in the "default" namespace.
To change that adjust the "target" in your client configmap:
target: grpc-server-svc.default.svc.cluster.local:8080
to:
target: grpc-server-svc.MYNAMESPACE.svc.cluster.local:8080
All code is here: https://github.com/hyrsh/simplegrpc
Content type
Image
Digest
sha256:77bd93a49…
Size
3.2 MB
Last updated
over 3 years ago
docker pull hyrsh/simplegrpc:1.0