All Projects → plutov → Benchmark Grpc Protobuf Vs Http Json

plutov / Benchmark Grpc Protobuf Vs Http Json

Benchmarks comparing gRPC+Protobuf vs JSON+HTTP in Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Benchmark Grpc Protobuf Vs Http Json

Go Micro Services
HTTP up front, Protobufs in the rear
Stars: ✭ 853 (+704.72%)
Mutual labels:  grpc, protobuf
Protoc Gen Twirp swagger
Swagger generator for twirp
Stars: ✭ 54 (-49.06%)
Mutual labels:  grpc, protobuf
Grpc
An Elixir implementation of gRPC
Stars: ✭ 858 (+709.43%)
Mutual labels:  grpc, protobuf
Grpc.jl
gRPC framework for Julia
Stars: ✭ 18 (-83.02%)
Mutual labels:  grpc, protobuf
Orion
Orion is a small lightweight framework written around grpc/protobuf with the aim to shorten time to build microservices at Carousell.
Stars: ✭ 101 (-4.72%)
Mutual labels:  grpc, protobuf
Rpc Thunderdome
A comparison between Proteus RPC and other commonly used RPC frameworks
Stars: ✭ 22 (-79.25%)
Mutual labels:  grpc, protobuf
Sol2proto
Ethereum contract ABI to gRPC protobuf IDL transpiler
Stars: ✭ 41 (-61.32%)
Mutual labels:  grpc, protobuf
Grpclib
Pure-Python gRPC implementation for asyncio
Stars: ✭ 615 (+480.19%)
Mutual labels:  grpc, protobuf
Grpcdump
Tool for capture and parse grpc traffic
Stars: ✭ 75 (-29.25%)
Mutual labels:  grpc, protobuf
Grpc Rust
Rust implementation of gRPC
Stars: ✭ 1,139 (+974.53%)
Mutual labels:  grpc, protobuf
Grpc Vs Rest
Comparing gRPC + Protobuf with REST + JSON
Stars: ✭ 17 (-83.96%)
Mutual labels:  rest, grpc
Go Shopping
A sample suite of services built on the go-micro framework
Stars: ✭ 98 (-7.55%)
Mutual labels:  grpc, protobuf
Protoreflect
Reflection (Rich Descriptors) for Go Protocol Buffers
Stars: ✭ 651 (+514.15%)
Mutual labels:  grpc, protobuf
Grpc Jersey
gRPC<->Jersey bridge
Stars: ✭ 23 (-78.3%)
Mutual labels:  grpc, protobuf
Brpc Java
Java implementation for Baidu RPC, multi-protocol & high performance RPC.
Stars: ✭ 647 (+510.38%)
Mutual labels:  grpc, protobuf
Grpc Contract
A tool to generate the grpc server code for a contract
Stars: ✭ 40 (-62.26%)
Mutual labels:  grpc, protobuf
Proteus
Generate .proto files from Go source code.
Stars: ✭ 593 (+459.43%)
Mutual labels:  grpc, protobuf
Kafka Pixy
gRPC/REST proxy for Kafka
Stars: ✭ 613 (+478.3%)
Mutual labels:  rest, grpc
Grpcc
A gRPC cli interface for easy testing against gRPC servers
Stars: ✭ 1,078 (+916.98%)
Mutual labels:  grpc, protobuf
Grpcweb Example
An example implementation of a GopherJS client and a Go server using the Improbable gRPC-Web implementation
Stars: ✭ 85 (-19.81%)
Mutual labels:  grpc, protobuf

gRPC+Protobuf or JSON+HTTP?

This repository contains 2 equal APIs: gRPC using Protobuf and JSON over HTTP. The goal is to run benchmarks for 2 approaches and compare them. APIs have 1 endpoint to create user, containing validation of request. Request, validation and response are the same in 2 packages, so we're benchmarking only mechanism itself. Benchmarks also include response parsing.

Requirements

  • Go 1.11

Run tests

Run benchmarks:

GO111MODULE=on go test -bench=. -benchmem

Results

goos: darwin
goarch: amd64
BenchmarkGRPCProtobuf-8            10000            117649 ns/op            7686 B/op        154 allocs/op
BenchmarkHTTPJSON-8                10000            105837 ns/op            8932 B/op        116 allocs/op
PASS
ok      github.com/plutov/benchmark-grpc-protobuf-vs-http-json  4.340s

They are almost the same, HTTP+JSON is a bit faster and has less allocs/op.

CPU usage comparison

This will create an executable benchmark-grpc-protobuf-vs-http-json.test and the profile information will be stored in grpcprotobuf.cpu and httpjson.cpu:

GO111MODULE=on go test -bench=BenchmarkGRPCProtobuf -cpuprofile=grpcprotobuf.cpu
GO111MODULE=on go test -bench=BenchmarkHTTPJSON -cpuprofile=httpjson.cpu

Check CPU usage per approach using:

go tool pprof grpcprotobuf.cpu
go tool pprof httpjson.cpu

My results show that Protobuf consumes less ressources, around 30% less.

gRPC definition

  • Install Go
  • Install Protocol Buffers
  • Install protoc plugin: go get github.com/golang/protobuf/proto github.com/golang/protobuf/protoc-gen-go
protoc --go_out=plugins=grpc:. grpc-protobuf/proto/api.proto
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].