GitXplorerGitXplorer
m

grpc-example

public
11 stars
5 forks
0 issues

Commits

List of commits on branch main.
Verified
e192e2f00b5fa7b1b401e66493342d3b7372fe99

Use the chainguard go-grpc-kit package (#2)

nn3wscott committed 3 years ago
Unverified
5a21bc4f77293ad40a2745117a4a9a7be2ca9409

Add GRPC client

mmattmoor committed 3 years ago
Unverified
fbacb437329eba188363cefd1fdc8dafa0403b69

Update README.md

mmattmoor committed 3 years ago
Unverified
f5461b333e970dd8a1ce75fbb3b20cc177575bc2

Check in a very simple Sample API as ksvc.

mmattmoor committed 3 years ago
Verified
d8ddf46470b84ab3b64567cf3c78e8f090c2c8f9

Initial commit

mmattmoor committed 3 years ago

README

The README file for this repository.

Simple GRPC/REST API as a Knative Service.

This repository contains a simple GRPC/REST API, which can be run as a Knative service.

Local

To run the service locally:

go run ./cmd/server

To hit the server locally:

# Create
curl -X POST -d '{"field1":"foo","field2":"bar"}' http://localhost:8080/v1/things

# List
curl http://localhost:8080/v1/things

Knative

To install Knative, my goto is mink (replace mattmoor.dev with your own domain):

mink install --domain mattmoor.dev

Note: mink prints the DNS record you need to configure for the specified domain when it is done.

To deploy this to Knative Serving:

ko apply -Bf config/

Now you should be able to curl things:

curl https://foo.default.mattmoor.dev/v1/things

Or load test things, my goto is vegeta (edit attack.log with your domain):

vegeta -cpus=1 attack -duration=4m -rate=1000/1s -targets=attack.log | vegeta report -type='hist[0,10ms,100ms,1s,10s]'

This should generate a nice little report with latency breakdown (it is most interesting if you let things scale to zero first!):

Bucket           #       %       Histogram
[0s,     10ms]   163     0.07%   
[10ms,   100ms]  233302  97.21%  ########################################################################
[100ms,  1s]     4487    1.87%   #
[1s,     10s]    2048    0.85%   
[10s,    +Inf]   0       0.00%