forked from grpc/grpc-go
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codec/proto: allow reuse of marshal byte buffers
Performance benchmarks can be found below. Obviously, a 10KB request and 10KB response is tailored to showcase this improvement as this is where codec buffer re-use shines, but I've run other benchmarks too (like 1-byte requests and responses) and there's no discernable impact on performance. To no one's surprise, the number of bytes allocated per operation goes down by almost exactly 10 KB across 60k+ queries, which suggests excellent buffer re-use. The number of allocations itself increases by 5-ish, but that's probably because of a few additional slice pointers that we need to store; these are 8-byte allocations and should have virtually no impact on the allocator and garbage collector. We do not allow reuse of buffers when stat handlers or binlogs are turned on. This is because those two may need access to the data and payload even after the data has been written to the wire. In such cases, we never return the data back to the pool. streaming-networkMode_none-bufConn_false-keepalive_false-benchTime_1m0s-trace_false-latency_0s-kbps_0-MTU_0-maxConcurrentCalls_1-reqSize_10240B-respSize_10240B-compressor_off-channelz_false-preloader_false Title Before After Percentage TotalOps 370480 372395 0.52% SendOps 0 0 NaN% RecvOps 0 0 NaN% Bytes/op 116049.91 105488.90 -9.10% Allocs/op 111.59 118.27 6.27% ReqT/op 505828693.33 508443306.67 0.52% RespT/op 505828693.33 508443306.67 0.52% 50th-Lat 142.553µs 143.951µs 0.98% 90th-Lat 193.714µs 192.51µs -0.62% 99th-Lat 549.345µs 545.059µs -0.78% Avg-Lat 161.506µs 160.635µs -0.54% Closes grpc#2816
- Loading branch information
Adhityaa Chandrasekar
committed
Nov 8, 2019
1 parent
4717e3b
commit 472543c
Showing
10 changed files
with
147 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.