Skip to content

perf(datapath): remove unused fields from sub/unsub messages mirrored…#1584

Open
markpmarton wants to merge 11 commits into
agntcy:mainfrom
markpmarton:clone_msg_header_to_controlplane
Open

perf(datapath): remove unused fields from sub/unsub messages mirrored…#1584
markpmarton wants to merge 11 commits into
agntcy:mainfrom
markpmarton:clone_msg_header_to_controlplane

Conversation

@markpmarton

@markpmarton markpmarton commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

closes #1387

Description

Remote Subscribe and Unsubscribe messages are sent by the receiver Data-Plane to the Control-Plane. As the Control-Plane processes only the destination name and the subscription_id, it is unnecessary to mirror the complete message to CP.

Actions

  • message cloning replaced with new message only containing the fields required by the Control-Plane
  • bench tests were added for process_stream function (latency & malloc)

Results

In my environment (Macbook M4 Pro) I experienced a minor improvement in the latency of the process_stream function (with mocked CP connection) in the cost of slightly higher heap allocation.

Latency original (us) Latency new (us) Heap alloc original (bytes) Heap alloc new (bytes)
Run 1 19.989 19.588 82877 82979
Run 2 20.153 20.061 82874 82976
Run 3 20.092 19.999 82877 82979
Run 4 20.039 20.017 82874 82976
Run 5 20.030 19.990 82874 82976

In conclusion: no significant improvement achieved (0.5-2%), because only sub/unsub messages were affected which don't contain a lot of data in the first place.

Although the change doesn't provide significant improvement, due to the added bench tests, this PR might still be worth merging.

Type of Change

  • Bugfix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
data-plane/core/datapath/src/messages/utils.rs 97.61% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

… to control-plane

Signed-off-by: Mark Marton <mark.p.marton@gmail.com>
@markpmarton markpmarton force-pushed the clone_msg_header_to_controlplane branch from 34dbd87 to b8fa79f Compare April 29, 2026 08:08
markpmarton and others added 6 commits April 29, 2026 10:27
Signed-off-by: Mark Marton <mark.p.marton@gmail.com>
Signed-off-by: Mark Marton <mark.p.marton@gmail.com>
Signed-off-by: Mark Marton <mark.p.marton@gmail.com>
Signed-off-by: Mark Marton <mark.p.marton@gmail.com>
@markpmarton markpmarton marked this pull request as ready for review April 29, 2026 15:23
@markpmarton markpmarton requested a review from a team as a code owner April 29, 2026 15:23
markpmarton and others added 4 commits May 4, 2026 06:42
Signed-off-by: Mark Marton <mark.p.marton@gmail.com>
Signed-off-by: Mark Marton <30534230+markpmarton@users.noreply.github.com>
Signed-off-by: Mark Marton <mark.p.marton@gmail.com>
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.

Control-plane sub/unsub clone in stream loop

1 participant