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

[Bifrost] LocalLoglet push-down filtering and new record format #1826

Merged
merged 6 commits into from
Aug 13, 2024

Conversation

AhmedSoliman
Copy link
Contributor

@AhmedSoliman AhmedSoliman commented Aug 12, 2024

[Bifrost] LocalLoglet push-down filtering and new record format

This introduces push-down key-based filtering support in local-loglet along with a new on-disk record layout that supports key checking without copying the payload over. It's extensible through an unused flags field and is currently used to store the key length and the key itself.
The new record layout is not enabled by default. This allows the next release to be the first safe version to rollback into once the new format is enabled.

Keys are now stored in the legacy payload holder as well, in a backward compatible fashion.

Code is not my prettiest, but the logic is solid ;)


Stack created with Sapling. Best reviewed with ReviewStack.

Copy link

github-actions bot commented Aug 12, 2024

Test Results

  5 files   -  97    5 suites   - 97   7m 12s ⏱️ - 16m 20s
 41 tests  -  43   41 ✅  -  43  0 💤 ±0  0 ❌ ±0 
101 runs   - 116  101 ✅  - 116  0 💤 ±0  0 ❌ ±0 

Results for commit 37d20d4. ± Comparison against base commit 5db1cba.

This pull request removes 84 and adds 41 tests. Note that renamed tests count towards both.
dev.restate.e2e.JavaAwaitTimeoutTest ‑ Test Awaitable#await(Duration)
dev.restate.e2e.JavaAwakeableTest ‑ generate(Client)
dev.restate.e2e.JavaCancelInvocationTest ‑ cancel blocked invocation on AWAKEABLE
dev.restate.e2e.JavaCancelInvocationTest ‑ cancel blocked invocation on CALL
dev.restate.e2e.JavaCancelInvocationTest ‑ cancel blocked invocation on SLEEP
dev.restate.e2e.JavaCoordinatorWithNodeReceiverServiceToServiceCallTest ‑ synchronousCall(Client)
dev.restate.e2e.JavaErrorsTest ‑ Test calling method that fails terminally
dev.restate.e2e.JavaErrorsTest ‑ Test calling method that fails terminally multiple times
dev.restate.e2e.JavaErrorsTest ‑ Test invocations are retried until they succeed
dev.restate.e2e.JavaErrorsTest ‑ Test propagate failure from another service
…
dev.restate.sdktesting.tests.AwaitTimeout ‑ timeout(Client)
dev.restate.sdktesting.tests.CallOrdering ‑ ordering(boolean[], Client)[1]
dev.restate.sdktesting.tests.CallOrdering ‑ ordering(boolean[], Client)[2]
dev.restate.sdktesting.tests.CallOrdering ‑ ordering(boolean[], Client)[3]
dev.restate.sdktesting.tests.CancelInvocation ‑ cancelInvocation(BlockingOperation, Client, URL)[1]
dev.restate.sdktesting.tests.CancelInvocation ‑ cancelInvocation(BlockingOperation, Client, URL)[2]
dev.restate.sdktesting.tests.CancelInvocation ‑ cancelInvocation(BlockingOperation, Client, URL)[3]
dev.restate.sdktesting.tests.Ingress ‑ headersPassThrough(Client)
dev.restate.sdktesting.tests.Ingress ‑ idempotentInvokeSend(Client)
dev.restate.sdktesting.tests.Ingress ‑ idempotentInvokeService(Client)
…

♻️ This comment has been updated with latest results.

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Nice work @AhmedSoliman :-) LGTM. +1 for merging.

- Design for lazy serialization and deserialization
- In-memory loglet now skips serialization entirely
- LogEntry api enables future key-filtering (upcoming)
- Fixed benchmarks
- Decouple local-loglet's storage layout from Bifrost
- Pave for in-memory record cache
- Simplified loglet's API, everything now goes through the append_batch API
- Support for passing payloads through an Arc since our payloads are pretty large in inefficient to pass through mpsc channels by value. Using Arc internally in bifrost allows near-zero cost clones on retries, caching of records, and zero-cost delivery to readers with no memory copies or deserialization.
- Removes requirement for metadata store's value to be `Clone` since StorageEncode is now object-safe

As a result of all recent changes, benchmarks show nearly _almost_ double the append throughput, although impact on production workloads will likely be small at this stage
- Upgrade derive_more
- Use derive_more as much as possible (it has a comprehensive list of powerful derive macros)
  - Some `strum::Display` macros still exist whenever we need parity to serde's kebab-case style.
  - Replaces `strum::EnumIs` with `derive_more::IsVariant`
  - Replaces `strum::FromRepr` with `derive_more::TryFrom`
- Clean ups: strum_macros -> strum (using `derive` feature on `strum` instead of a separate crate. Easier to grep, and one version to maintain)
- Remove unused deps in bifrost to speed up builds
- Removed a couple of Debug fields in bifrost where we were printing a value under mutex
dashmap v6.0.1 brings nice performance improvements anywhere in 5-40% range
This introduces push-down key-based filtering support in local-loglet along with a new on-disk record layout that supports key checking without copying the payload over. It's extensible through an unused flags field and is currently used to store the key length and the key itself.
The new record layout is not enabled by default. This allows the next release to be the first safe version to rollback into once the new format is enabled.

Keys are now stored in the legacy payload holder as well, in a backward compatible fashion.

Code is not my prettiest, but the logic is solid ;)
@AhmedSoliman
Copy link
Contributor Author

Thanks @tillrohrmann for the review. I'll merge the stack once GHA is green.

@AhmedSoliman AhmedSoliman merged commit 37d20d4 into main Aug 13, 2024
19 checks passed
@AhmedSoliman AhmedSoliman deleted the pr1826 branch August 13, 2024 16:03
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