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

Dynamic send #276

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Dynamic send #276

wants to merge 6 commits into from

Conversation

allevo
Copy link
Contributor

@allevo allevo commented Feb 19, 2025

This PR implements a new method to send a message:

  • batch_send follows the same flow as send
  • every message is queued on a dedicated Tokio task and sent asynchronously
  • if the internal producer is closed, the task stops to send
  • remove batch_publishing_delay params (breaking)
  • put integration tests under tests to avoid parallel execution. Parallel execution causes problems running the tests locally due to the limitation of the OS file description number.

I introduced also a bin to calculate the latency performance to proof the improvement on low send rate. The bin creates a producer and a consumer. Every minute, 50 messages with the current timestamp are sent to RabbitMQ and the consumer store the metric. Every minute, a log is printed with the statistics.

Before this PR:

$ cargo run --release --bin perf-producer
stats: Stats { average_latency: 59.54067, messages_received: 3000 }
stats: Stats { average_latency: 62.840668, messages_received: 3000 }
stats: Stats { average_latency: 58.391335, messages_received: 3000 }
stats: Stats { average_latency: 58.668335, messages_received: 3000 }

After this PR:

$ cargo run --release --bin perf-producer
stats: Stats { average_latency: 5.1963334, messages_received: 3000 }
stats: Stats { average_latency: 5.195667, messages_received: 3000 }
stats: Stats { average_latency: 5.288, messages_received: 3000 }
stats: Stats { average_latency: 5.148667, messages_received: 3000 }

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 17.54386% with 141 lines in your changes missing coverage. Please review.

Project coverage is 88.85%. Comparing base (be36db2) to head (e171dcc).

Files with missing lines Patch % Lines
src/bin/perf-producer.rs 0.00% 132 Missing ⚠️
src/producer.rs 78.94% 8 Missing ⚠️
src/client/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
- Coverage   90.17%   88.85%   -1.32%     
==========================================
  Files          80       81       +1     
  Lines        7390     7504     +114     
==========================================
+ Hits         6664     6668       +4     
- Misses        726      836     +110     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@allevo allevo marked this pull request as ready for review February 19, 2025 13:39
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.

1 participant