Skip to content

Instantly share code, notes, and snippets.

@josue
Last active Oct 18, 2018
Embed
What would you like to do?
grpc benchmark testing using ghz with kairosnet.proto
{
"host": "orchestrator:6777",
"proto": "kairosnet.proto",
"call": "kairosnet.Api.Detect",
"n": 1000,
"c": 50,
"D": "data.json"
}
{
"logData": {
"job": "detect",
"jobId": "fake-job-id-123",
"appId": "b537b04d"
},
"galleryName": "celebs",
"subjectId": "9ice",
"filename": "liz_40x40.png",
"content": "iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAIEaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA1LjQuMCI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj44NTg8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+NzMwPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CpSXhF8AAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIWUExURSEKIiINILyiiy8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gotSUab68/EjGzRmADRaIy2OrLOWMll4uSihE1/RAgiZGppKBmHCoUETN99o9L7Bo3Ni64KEZD1J3HOCThleISn8mviMAFKWOK8OWtjNm6jWPGAIpZEfrywJmKRIVVcilUs8bE8Sv6Xs64RuyYG9ga2xrYvQh4YI2C5S03gwRSxUDhnpzk+P0RVuub6trESkVbW0VFxUCz86WxqS/uZtBoVCVDiVopkqoqjj9yoK3rr29bXVxcdbkq5sYuAtg3DHnkxd2olcpgMKhUbH9fzIqYD7Q72r9esrgKnbvOQMD5BP91nItaVS0MJYlEw6wU6lB2aGPx8+nfeBZdML3Z2ZK9TMBNEediVm6LEqXSaDSMRMHTdgrw9BQaV11z3c2e59qefwE3GIZ7MJZMJwAAAABJRU5ErkJggg=="
}
syntax = "proto3";
package kairosnet;
service Api {
rpc Enroll(ContentParserOptions) returns (Response) {}
rpc Detect(ContentParserOptions) returns (Response) {}
rpc Recognize(ContentParserOptions) returns (Response) {}
rpc Verify(ContentParserOptions) returns (Response) {}
rpc ListAllAssocGalleries(ContentParserOptions) returns (Response) {}
rpc ViewSubjectInGallery(ContentParserOptions) returns (Response) {}
rpc RemoveSubjectFromGallery(ContentParserOptions) returns (Response) {}
rpc RemoveSpecifiedGallery(ContentParserOptions) returns (Response) {}
rpc ViewSpecifiedGallery(ContentParserOptions) returns (Response) {}
}
message LogData {
string job=1;
string jobId=2;
string appId=3;
}
message ContentParserOptions {
string filepath=1;
string filename=2;
bytes content=3;
float minHeadScale=4;
string selector=5;
string subjectId=6;
string galleryName=7;
bool multipleFaces=8;
float threshold=9;
int32 maxNumResults=10;
string faceId=11;
LogData logData=12;
int32 orientationDegree=13;
string appId=14;
string sourceStorage=15;
string sourceLocation=16;
int32 version=17;
}
message Response {
string json=1;
}
@josue
Copy link
Author

josue commented May 22, 2018

requires:

ghz - Simple gRPC benchmarking and load testing tool

download + install ghz + files:

export version=0.13.0 && \
apt update && apt install -y curl vim && \
cd /tmp && \
curl -LO https://github.com/bojand/ghz/releases/download/v${version}/ghz_${version}_linux_amd64.tar.gz && \
tar -xvf ghz_${version}_linux_amd64.tar.gz && \
mkdir -p /tmp/data && \
curl -L -o /tmp/data/config.json https://gist.githubusercontent.com/josue/3bd80fa17c2efa0bdbe3cee49159eb17/raw/config.json && \
curl -L -o /tmp/data/data.json https://gist.githubusercontent.com/josue/3bd80fa17c2efa0bdbe3cee49159eb17/raw/data.json && \
curl -L -o /tmp/data/kairosnet.proto https://gist.githubusercontent.com/josue/3bd80fa17c2efa0bdbe3cee49159eb17/raw/kairosnet.proto

usage:

# using params
./ghz -n 2000 -c 20 -insecure -proto /tmp/data/kairosnet.proto -call kairosnet.Api.Detect -D /tmp/data/data.json orchestrator:6777

# using config file
./ghz -insecure -config config.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment