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

Blocking command support (BLPOP/BRPOP & BLMOVE) #356

Merged
merged 47 commits into from
Jun 21, 2024

Conversation

TalZaccai
Copy link
Contributor

@TalZaccai TalZaccai commented May 2, 2024

  • Adding support for blocking commands in Garnet (for List and SortedSet objects)
  • Implementing logic for BRPOP/BLPOP & BLMOVE commands

Still remaining to address in this PR:

  • Block processing of further commands once a blocking command has been called
  • Stop the main loop in CollectionItemBroker if there are no active observers
  • Periodically clean up "zombie" observers (observers whose resp session has disposed but are still on the key's observer queue)
  • Remove keys whose observer queues are empty
  • Add more test cases

Added some website docs for the ItemBroker class here: website/docs/dev/collection-broker.md

@TalZaccai TalZaccai requested a review from badrishc May 2, 2024 22:37
@TalZaccai TalZaccai added enhancement New feature or request API labels May 2, 2024
@TalZaccai TalZaccai requested a review from badrishc June 4, 2024 22:39
@TalZaccai TalZaccai changed the title [WIP] Blocking command support Blocking command support (BLPOP/BRPOP) Jun 4, 2024
@TalZaccai TalZaccai linked an issue Jun 13, 2024 that may be closed by this pull request
@badrishc
Copy link
Contributor

Please report BDN results of main vs. this branch for -f *.RespParseStress.*

Copy link
Contributor

@badrishc badrishc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments mostly related to allocations (both byte[] and Task) and potentially heavy code paths. We need to optimize for:

  1. The case where BL* instructions are not used (i.e., heavy classes are created lazily)
  2. Optional - avoid byte[] allocations by keeping items in FasterLog
  3. Avoid Task allocations by using the async codepath only when no items available to process synchronously.

@TalZaccai TalZaccai requested a review from badrishc June 18, 2024 21:18
@TalZaccai
Copy link
Contributor Author

Please report BDN results of main vs. this branch for -f *.RespParseStress.*

current branch:

Method Job EnvironmentVariables Runtime Mean Error StdDev Allocated
InlinePing .NET 6 Empty .NET 6.0 3.736 us 0.0444 us 0.0394 us -
Set .NET 6 Empty .NET 6.0 40.151 us 0.5339 us 0.4994 us -
SetEx .NET 6 Empty .NET 6.0 49.062 us 0.9620 us 0.8033 us -
Get .NET 6 Empty .NET 6.0 23.247 us 0.4078 us 0.3815 us -
ZAddRem .NET 6 Empty .NET 6.0 203.544 us 3.8383 us 3.5903 us 23552 B
InlinePing .NET 8 DOTNET_TieredPGO=0 .NET 8.0 3.246 us 0.0126 us 0.0098 us -
Set .NET 8 DOTNET_TieredPGO=0 .NET 8.0 27.550 us 0.0505 us 0.0394 us -
SetEx .NET 8 DOTNET_TieredPGO=0 .NET 8.0 38.817 us 0.4597 us 0.4300 us -
Get .NET 8 DOTNET_TieredPGO=0 .NET 8.0 17.808 us 0.1461 us 0.1296 us -
ZAddRem .NET 8 DOTNET_TieredPGO=0 .NET 8.0 167.105 us 3.1375 us 2.7813 us 23552 B

main:

Method Job EnvironmentVariables Runtime Mean Error StdDev Allocated
InlinePing .NET 6 Empty .NET 6.0 3.461 us 0.0321 us 0.0268 us -
Set .NET 6 Empty .NET 6.0 38.975 us 0.7435 us 0.7302 us -
SetEx .NET 6 Empty .NET 6.0 50.464 us 0.3800 us 0.3173 us -
Get .NET 6 Empty .NET 6.0 22.726 us 0.1165 us 0.0910 us -
ZAddRem .NET 6 Empty .NET 6.0 195.731 us 1.7133 us 1.4307 us 23552 B
InlinePing .NET 8 DOTNET_TieredPGO=0 .NET 8.0 3.376 us 0.0247 us 0.0219 us -
Set .NET 8 DOTNET_TieredPGO=0 .NET 8.0 27.949 us 0.1557 us 0.1300 us -
SetEx .NET 8 DOTNET_TieredPGO=0 .NET 8.0 38.309 us 0.2966 us 0.2774 us -
Get .NET 8 DOTNET_TieredPGO=0 .NET 8.0 18.324 us 0.1501 us 0.1404 us -
ZAddRem .NET 8 DOTNET_TieredPGO=0 .NET 8.0 165.709 us 3.2412 us 4.9496 us 23552 B

@TalZaccai TalZaccai merged commit b322f29 into main Jun 21, 2024
26 checks passed
@TalZaccai TalZaccai deleted the talzacc/blocking_list_ops branch June 21, 2024 19:16
@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend API to support Sidekiq
2 participants