-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: connection close hang #658
Open
stevenh
wants to merge
2
commits into
master
Choose a base branch
from
fix/reply-off
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
stevenh
force-pushed
the
fix/reply-off
branch
6 times, most recently
from
February 3, 2024 15:03
8df9f74
to
6e0c9b8
Compare
stevenh
force-pushed
the
fix/reply-off
branch
from
February 3, 2024 15:54
6e0c9b8
to
41a3669
Compare
Fix connection Close hanging if CLIENT REPLY is set to OFF or SKIP. This includes a rework of how command actions are handled to use a single map lookup based on generated permutations to improve performance and allow it to be used in both activeConn and conn. Replication of this lookup is need as its impossible to share information between the different Conn interface implementations due to returning interface instead of concrete type. The performance improvements, 33-89% sec/op and eliminating all memory allocations, help to mitigate the impact of double lookup. This also expands the benchmark coverage to allow for wider validation of this change. Fixes #361 go test -run=^$ -bench=BenchmarkLookupCommand -count=10 -benchmem > orig.log benchstat orig.log permute.log goos: linux goarch: amd64 pkg: github.com/gomodule/redigo/redis cpu: 11th Gen Intel(R) Core(TM) i9-11900H @ 2.50GHz │ orig.log │ permute.log │ │ sec/op │ sec/op vs base │ LookupCommandInfoCorrectCase-16 55.89n ± 7% 37.24n ± 2% -33.37% (p=0.000 n=10) LookupCommandInfoMixedCase-16 359.85n ± 9% 38.79n ± 2% -89.22% (p=0.000 n=10) LookupCommandInfoNoMatch-16 262.45n ± 1% 36.98n ± 4% -85.91% (p=0.000 n=10) geomean 174.1n 37.66n -78.37% │ orig.log │ permute.log │ │ B/op │ B/op vs base │ LookupCommandInfoCorrectCase-16 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ LookupCommandInfoMixedCase-16 32.00 ± 0% 0.00 ± 0% -100.00% (p=0.000 n=10) LookupCommandInfoNoMatch-16 8.000 ± 0% 0.000 ± 0% -100.00% (p=0.000 n=10) geomean ² ? ² ³ ¹ all samples are equal ² summaries must be >0 to compute geomean ³ ratios must be >0 to compute geomean │ orig.log │ permute.log │ │ allocs/op │ allocs/op vs base │ LookupCommandInfoCorrectCase-16 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹ LookupCommandInfoMixedCase-16 4.000 ± 0% 0.000 ± 0% -100.00% (p=0.000 n=10) LookupCommandInfoNoMatch-16 2.000 ± 0% 0.000 ± 0% -100.00% (p=0.000 n=10) geomean ² ? ² ³ ¹ all samples are equal ² summaries must be >0 to compute geomean ³ ratios must be >0 to compute geomean
stevenh
force-pushed
the
fix/reply-off
branch
from
February 3, 2024 16:01
41a3669
to
df45f1e
Compare
This was referenced Feb 8, 2024
Open
Add support for newer command which impact the state of a client connection hence need special handling when returning connections to the pool. Also add missing type assertions for ConnWithContext on connection types.
stevenh
force-pushed
the
fix/reply-off
branch
from
February 13, 2024 21:20
df45f1e
to
f5f94cf
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix connection
Close()
hanging ifCLIENT REPLY
is set toOFF
orSKIP
.This includes a rework of how command actions are handled to use a single map lookup based on generated permutations to improve performance and allow it to be used in both
activeConn
andconn
. Replication of this lookup is need as its impossible to share information between the differentConn
interface implementations due to returning interface instead of concrete type.The performance improvements, 33-89% sec/op and eliminating all memory allocations, help to mitigate the impact of double lookup.
This also expands the benchmark coverage to allow for wider validation of this change.
Fixes #361