Skip to content

Conversation

@Jansen-w
Copy link

@Jansen-w Jansen-w commented Dec 5, 2025

Summary

This PR fixes some severe performance issues which were discovered when load testing and profiling the disk buffer v2 implementation. UUID's were added to event metadata in #21074, and while regression tests were run on that branch before merging, there weren't any regression tests which test disk buffer performance. While adding UUID's to events is inconsequential in most pipeline configurations, disk buffers were disproportionately affected by this change due to events being serialized to/deserialized from the buffer, which lead to an additional (immediately overwritten) UUID being generated per event upon deserialization (see fix in #24336). This PR enables the fast-rng feature in UUID which speeds up generation significantly, and switches the generator to v4 which further speeds up generation by foregoing v7's timestamp ordering.

All of these changes combined lead to a ~40% increase in bandwidth through a multi-threaded disk buffer load test with identical test settings.

Finally, this PR adds a regression test for disk buffers so we can test for disk buffer performance regressions in future contributions.

Flame graph of a thread before UUID optimizations:
image

After UUID Optimizations:
image

Vector configuration

How did you test this PR?

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Related: #24336

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details here.

v7 are created using a timestamp so they can be ordered, however this comes at a performance cost. We currently don't need to order these UUID's, so for now  we can use v4.
@Jansen-w Jansen-w requested a review from a team as a code owner December 5, 2025 20:16
@github-actions github-actions bot added the domain: core Anything related to core crates i.e. vector-core, core-common, etc label Dec 5, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

dropped_fields: ObjectMap::new(),
datadog_origin_metadata: None,
source_event_id: Some(Uuid::now_v7()),
source_event_id: Some(Uuid::new_v4()),

Choose a reason for hiding this comment

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

P1 Badge Align source_event_id test with v4 UUID default

Default metadata generation now uses Uuid::new_v4() to populate source_event_id (metadata.rs line 256), but the metadata_set_unique_uuid_v7_source_event_id unit test still asserts the auto-generated ID is a v7 (SortRand) UUID in lib/vector-core/src/event/log_event.rs. Running the test suite will now fail because new events return v4 UUIDs, so either revert the default or update the test/consumers to accept v4.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

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

Semi valid comment. Just need to update the test name

Copy link
Author

Choose a reason for hiding this comment

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

tracing-subscriber = { version = "0.3.20", default-features = false, features = ["fmt"] }
url = { version = "2.5.4", default-features = false, features = ["serde"] }
uuid = { version = "1.18.1", features = ["v4", "v7", "serde"] }
uuid = { version = "1.18.1", features = ["v4", "v7", "serde", "fast-rng"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove "v7" from the features list here now?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Wait the Websocket server sink still uses v7.. it compiles because v7 is enabled in transitive dependencies eg. vrl.

Copy link
Author

Choose a reason for hiding this comment

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

I'm going to add it back because it seems like it actually needs the v7 generation there for time ordered replays and we shouldn't rely on transitive dependencies to enable the feature

tracing-subscriber = { version = "0.3.20", default-features = false, features = ["fmt"] }
url = { version = "2.5.4", default-features = false, features = ["serde"] }
uuid = { version = "1.18.1", features = ["v4", "v7", "serde"] }
uuid = { version = "1.18.1", features = ["v4", "v7", "serde", "fast-rng"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

My guess it is isn't because it requires bringing in more dependencies, and if your not generating UUIDs on a hot path you wouldn't be caring about the internal lock

Copy link
Contributor

Choose a reason for hiding this comment

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

OTOH I wonder how many CPU cycles are wasted because people never included this dependency/feature lol. Pretty much any decently sized project will already depend on rand

Either way it's a very nice addition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: core Anything related to core crates i.e. vector-core, core-common, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants