containerd / ttrpc

GRPC for low-memory environments
Apache License 2.0
536 stars 78 forks source link

Introduce streaming #107

Closed dmcgowan closed 2 years ago

dmcgowan commented 2 years ago

Add implementation of streaming and generator for protoc-gen-go-ttrpc. Currently no generator implementation for protoc-gen-gogottrpc

codecov-commenter commented 2 years ago

Codecov Report

Merging #107 (9bc00a1) into main (b194a10) will decrease coverage by 1.32%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #107      +/-   ##
==========================================
- Coverage   63.29%   61.97%   -1.33%     
==========================================
  Files          11       12       +1     
  Lines        1049     1299     +250     
==========================================
+ Hits          664      805     +141     
- Misses        341      425      +84     
- Partials       44       69      +25     
Impacted Files Coverage Δ
src/github.com/containerd/ttrpc/client.go 64.68% <0.00%> (-10.94%) :arrow_down:
src/github.com/containerd/ttrpc/channel.go 73.17% <0.00%> (-8.37%) :arrow_down:
src/github.com/containerd/ttrpc/server.go 73.52% <0.00%> (-2.49%) :arrow_down:
src/github.com/containerd/ttrpc/interceptor.go 100.00% <0.00%> (ø)
src/github.com/containerd/ttrpc/stream.go 81.48% <0.00%> (ø)
src/github.com/containerd/ttrpc/services.go 60.24% <0.00%> (+12.52%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b194a10...9bc00a1. Read the comment docs.

dmcgowan commented 2 years ago

Marking this as ready for review

Benchmarking not showing a significant difference (only comparing unary requests obviously). There is one extra allocation in the new code, likely related to the new stream structure.

name                        old time/op    new time/op    delta
RoundTripUnixSocketCreds-8    26.3µs ± 0%    27.0µs ± 0%   ~     (p=1.000 n=1+1)
RoundTrip-8                   27.2µs ± 0%    25.5µs ± 0%   ~     (p=1.000 n=1+1)

name                        old alloc/op   new alloc/op   delta
RoundTripUnixSocketCreds-8    1.18kB ± 0%    1.31kB ± 0%   ~     (p=1.000 n=1+1)
RoundTrip-8                   1.18kB ± 0%    1.34kB ± 0%   ~     (p=1.000 n=1+1)

name                        old allocs/op  new allocs/op  delta
RoundTripUnixSocketCreds-8      27.0 ± 0%      28.0 ± 0%   ~     (p=1.000 n=1+1)
RoundTrip-8                     27.0 ± 0%      28.0 ± 0%   ~     (p=1.000 n=1+1)