This repository contains 2 equal APIs: using gRPC-Web with Envoy and using grpc-gateway. The goal is to run benchmarks for 2 approaches and compare them. APIs have 1 endpoint to ping. Benchmarks also include response parsing.
- Docker
- docker-compose
Using nodejs client and benchmarkify
lib to benchmark.
Deployment model:
Flow definition:
- Direct request: call direct HTTP request to backend. Review spring-grpc-http to know more about this back. Result in this test will be seen like a baseline.
- Using grpc-gateway: call backend by using grpc-gateway.
- Using gRPC-Web: using gRPC-Web to call to backend. There are two options:
mode=grpcwebtext
: Payload are base64-encoded.mode=grpcweb
: Payload are in the binary protobuf format.
Steps:
-
Start backend and gateways:
docker-compose -f docker-compose-backend.yaml up
-
Wait services is started successfully
-
Configure test time by edit BENCHMARK_TIME in
docker-compose-client.yaml
. -
Start client
docker-compose -f docker-compose-client.yaml up
As you see:
- Performance of gRPC-Web with text format and direct calling HTTP is nearly equal.
- grpc-gateway is more slower
- gRPC-Web with binary format is the fastest.
More detail in medium