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

feat(storagenode): add pipelined Append RPC handler #457

Merged
merged 10 commits into from
Jun 7, 2023

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented May 23, 2023

What this PR does

This patch changes the Append RPC handler to support pipelined requests and does not change the client's API. Therefore, users can use Append API transparently.

Supporting pipelined requests can lead to overhead since it is necessary to have additional goroutines and concurrent queues. To lower additional overhead, this change uses reader-biased mutex instead of built-in RWMutex to avoid shared lock contention. As a result of experimentations, this PR showed very little overhead. Furthermore, we can improve the existing Append API more efficiently using a long-lived stream: the current implementation creates a new stream whenever calling Append API, which leads to unnecessary tasks such as RPC initiation. We can reuse long-lived streams by changing client API. See this issue at #458.

Which issue(s) this PR resolves

This PR implements server-side parts of LogStreamAppender mentioned in #433. It also can be used for pipelining generic Append RPC said in #441.

@ijsong ijsong self-assigned this May 23, 2023
@ijsong ijsong marked this pull request as draft May 23, 2023 09:33
@ijsong ijsong force-pushed the pipelined_append_handler branch 2 times, most recently from 2a8118a to 317743d Compare May 24, 2023 07:22
@codecov-commenter
Copy link

codecov-commenter commented May 24, 2023

Codecov Report

Patch coverage: 52.38% and project coverage change: -0.03 ⚠️

Comparison is base (82c1e97) 63.18% compared to head (80abf51) 63.15%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@                               Coverage Diff                                @@
##           grpc_server_initial_flow_control_window_size     #457      +/-   ##
================================================================================
- Coverage                                         63.18%   63.15%   -0.03%     
================================================================================
  Files                                               132      132              
  Lines                                             17958    18145     +187     
================================================================================
+ Hits                                              11346    11459     +113     
- Misses                                             6040     6120      +80     
+ Partials                                            572      566       -6     
Impacted Files Coverage Δ
internal/storagenode/logstream/append.go 47.11% <0.00%> (-32.59%) ⬇️
internal/storagenode/config.go 47.40% <12.50%> (-2.20%) ⬇️
internal/storagenode/log_server.go 81.46% <90.59%> (+8.67%) ⬆️
internal/storagenode/storagenode.go 72.83% <100.00%> (+0.16%) ⬆️

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ijsong ijsong marked this pull request as ready for review May 24, 2023 07:41
@ijsong ijsong marked this pull request as draft May 25, 2023 06:04
@ijsong ijsong linked an issue May 25, 2023 that may be closed by this pull request
3 tasks
@ijsong ijsong marked this pull request as ready for review May 25, 2023 06:06
@ijsong ijsong force-pushed the grpc_server_initial_flow_control_window_size branch from 82c1e97 to 3d0cdbf Compare June 1, 2023 03:32
@ijsong ijsong force-pushed the grpc_server_initial_flow_control_window_size branch from 3d0cdbf to c2e0d4d Compare June 1, 2023 06:08
@ijsong ijsong force-pushed the grpc_server_initial_flow_control_window_size branch from c2e0d4d to dd3061c Compare June 1, 2023 23:47
@ijsong ijsong force-pushed the grpc_server_initial_flow_control_window_size branch from dd3061c to 8b623b0 Compare June 4, 2023 07:37
Base automatically changed from grpc_server_initial_flow_control_window_size to main June 4, 2023 08:01
@ijsong ijsong requested a review from hungryjang June 4, 2023 08:02
dependabot bot and others added 9 commits June 5, 2023 12:59
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@v3.4.0...v3.5.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.3 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.8.3...v1.8.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
…/golangci-lint-action-3.5.0

build(deps): bump golangci/golangci-lint-action from 3.4.0 to 3.5.0
…tretchr/testify-1.8.4

build(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.9.1 to 0.9.3.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](golang/tools@v0.9.1...v0.9.3)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
…/tools-0.9.3

build(deps): bump golang.org/x/tools from 0.9.1 to 0.9.3
Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.25.3 to 2.25.5.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](urfave/cli@v2.25.3...v2.25.5)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
…rfave/cli/v2-2.25.5

build(deps): bump github.com/urfave/cli/v2 from 2.25.3 to 2.25.5
@ijsong
Copy link
Member Author

ijsong commented Jun 7, 2023

@ijsong started a stack merge that includes this pull request via Graphite.

This patch changes the Append RPC handler to support pipelined requests and does not change the
client's API. Therefore, users can use Append API transparently.

Supporting pipelined requests can lead to overhead since it is necessary to have additional
goroutines and concurrent queues. To lower additional overhead, this change uses [reader-biased
mutex](https://github.com/puzpuzpuz/xsync#rbmutex) instead of built-in RWMutex to avoid shared lock
contention. As a result of experimentations, this PR showed very little overhead. Furthermore, we
can improve the existing Append API more efficiently
[using a long-lived stream](https://grpc.io/docs/guides/performance/#general): the current
implementation creates a new stream whenever calling Append API, which leads to unnecessary tasks
such as RPC initiation. We can reuse long-lived streams by changing client API. See this issue at #458.

This PR implements server-side parts of LogStreamAppender mentioned in #433. It also can be used for
pipelining generic Append RPC said in #441.
@ijsong
Copy link
Member Author

ijsong commented Jun 7, 2023

Graphite rebased this pull request as part of a merge.

@ijsong ijsong merged commit 0323629 into main Jun 7, 2023
@ijsong
Copy link
Member Author

ijsong commented Jun 7, 2023

@ijsong merged this pull request with Graphite.

@ijsong ijsong deleted the pipelined_append_handler branch June 7, 2023 16:45
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.

storagenode,client: introduce LogStreamAppender
3 participants