Giter Club home page Giter Club logo

benchmark-grpc-py-go's Introduction

Benchmark gRPC with golang and Python

Here we build and test two gRPC servers, one in golang and another in Python.

The servers implements just one function, Test1.

A proto file define Request and Response message from Test1 function:

syntax = "proto3";


option go_package = ".;service1";

service MyRPC1 {
    // just one function inside RPC server
    rpc Test1(Benchmark) returns(Response){}

}

message Response {
    string text = 1; // server response
    uint32 crc32 = 2; // computed crc32 of received buffer
}

message Benchmark {
    string name = 1; // benchmark name
    bytes buffer = 2; // benchmark buffer
}

The protoc compiler generate "stub files" used to build the code.

The code import the "stub files", then the server implement Test1 function and the client call the Test1 function.

There are batch files (for Windows) used to generate "stub files" and to call the servers and clients, but the recipe also works in Linux with some minor changes.

The servers can use an OpenSSL certificate, but the user authentification is not implemented.

The servers compute crc32 of received buffer and return it to client, the clients also compute crc32 of buffer and verify it.

The Python implementation works on both Python 2.7 and Python 3.8

Calling the go server:

SET HOST=localhost:6002
cd go-server
start "go gRPC server secure on %HOST%" go run . -host %HOST% -secured

go server

Both, go and py, clients call go server with batch size 2048 KB:

SET HOST=localhost:6002
SET BS=2048
SET N=5
title Test go server secured - %HOST%
cd go-client
go run . -host %HOST% -bs %BS% -n %N% -secured
cd ..\py-client-server
python client.py -host %HOST% -bs %BS% -n %N% -secured
pause

go and py client call go server

Calling the python server:

SET HOST=localhost:6004
start "py gRPC server secure on %HOST%" python server.py -host %HOST% -secured

py server

Both, go and py, clients call py server with batch size 2048 KB:

SET HOST=localhost:6004
SET BS=2048
SET N=5
title Test py server secured - %HOST%
cd go-client
go run . -host %HOST% -bs %BS% -n %N% -secured
cd ..\py-client-server
python client.py -host %HOST% -bs %BS% -n %N% -secured
pause

go and py client call py server

benchmark-grpc-py-go's People

Contributors

icoman avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.