Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(benchmark): use grpc.SharedBufferPool for grpc.DialOption #718

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented Feb 25, 2024

What this PR does

When a client library parses incoming gRPC messages, it allocates new buffers
frequently. This can result in the creation of a large number of heap objects.
However, gRPC offers an experimental feature called the shared buffer pool that
can be used to address this issue.

This pull request (PR) aims to optimize the gRPC receiving path using the shared
buffer pool. Various experiments have shown that this optimization leads to a
decrease in CPU time of runtime.gcBgMarkWorkers, depending on the workload.

Since the shared buffer pool is experimental, it is applied only to the
benchmark.

Refs:

Copy link

codecov bot commented Feb 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 49.75%. Comparing base (31dfe88) to head (8014ece).

Files Patch % Lines
pkg/varlog/options.go 0.00% 4 Missing ⚠️
internal/benchmark/loader.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #718      +/-   ##
==========================================
+ Coverage   49.70%   49.75%   +0.04%     
==========================================
  Files         235      235              
  Lines       20709    20715       +6     
==========================================
+ Hits        10294    10306      +12     
+ Misses       9773     9771       -2     
+ Partials      642      638       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ijsong ijsong force-pushed the feat_benchmark_gops_agent branch from 5c8e443 to c387533 Compare February 25, 2024 13:03
@ijsong ijsong self-assigned this Feb 25, 2024
@ijsong ijsong marked this pull request as draft February 25, 2024 13:06
@ijsong ijsong force-pushed the feat_benchmark_gops_agent branch from c387533 to 76484b8 Compare February 25, 2024 13:09
@ijsong ijsong force-pushed the perf_grpc_client_sharedbuffer branch from 37baf23 to 889b990 Compare February 25, 2024 13:15
@ijsong ijsong force-pushed the feat_benchmark_gops_agent branch from 76484b8 to f370427 Compare February 26, 2024 14:43
@ijsong ijsong force-pushed the perf_grpc_client_sharedbuffer branch from 889b990 to 01fbf39 Compare February 26, 2024 14:43
@ijsong ijsong force-pushed the feat_benchmark_gops_agent branch from f370427 to 9f31816 Compare February 26, 2024 15:18
Base automatically changed from feat_benchmark_gops_agent to main February 26, 2024 15:26
@ijsong ijsong force-pushed the perf_grpc_client_sharedbuffer branch 2 times, most recently from c39f3e6 to d604b6f Compare February 28, 2024 04:23
@ijsong ijsong changed the title perf(client): use grpc.SharedBufferPool for grpc.DialOption perf(benchmark): use grpc.SharedBufferPool for grpc.DialOption Feb 28, 2024
@ijsong ijsong force-pushed the perf_grpc_client_sharedbuffer branch from d604b6f to 10a0efb Compare February 28, 2024 04:30
@ijsong ijsong changed the base branch from main to bump_mockgen_from_0_3_0_to_0_4_0 February 28, 2024 04:30
@ijsong ijsong marked this pull request as ready for review February 28, 2024 04:31
@ijsong ijsong force-pushed the bump_mockgen_from_0_3_0_to_0_4_0 branch from 6a06c96 to 5d97667 Compare February 28, 2024 04:48
@ijsong ijsong force-pushed the perf_grpc_client_sharedbuffer branch from 10a0efb to 40506df Compare February 28, 2024 04:48
Base automatically changed from bump_mockgen_from_0_3_0_to_0_4_0 to main March 5, 2024 05:46
When a client library parses incoming gRPC messages, it allocates new buffers
frequently. This can result in the creation of a large number of heap objects.
However, gRPC offers an experimental feature called the shared buffer pool that
can be used to address this issue.

This pull request (PR) aims to optimize the gRPC receiving path using the shared
buffer pool. Various experiments have shown that this optimization leads to a
decrease in CPU time of runtime.gcBgMarkWorkers, depending on the workload.

Since the shared buffer pool is experimental, it is applied only to the
benchmark.

Refs:
- https://pkg.go.dev/google.golang.org/[email protected]/experimental#WithRecvBufferPool
- https://pkg.go.dev/google.golang.org/[email protected]#SharedBufferPool
@ijsong ijsong force-pushed the perf_grpc_client_sharedbuffer branch from 40506df to 8014ece Compare March 5, 2024 07:02
@ijsong
Copy link
Member Author

ijsong commented Mar 5, 2024

Merge activity

  • Mar 5, 4:41 AM EST: @ijsong started a stack merge that includes this pull request via Graphite.
  • Mar 5, 4:41 AM EST: @ijsong merged this pull request with Graphite.

@ijsong ijsong merged commit fbf0c17 into main Mar 5, 2024
18 checks passed
@ijsong ijsong deleted the perf_grpc_client_sharedbuffer branch March 5, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants