Skip to content

Write to the outgoing pipeline directly #245

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

Closed
wants to merge 4 commits into from

Conversation

lukebakken
Copy link
Contributor

I still have benchmarking to do, but this method should be faster.

Learning a bit after reading about System.IO.Pipelines - link

@lukebakken lukebakken self-assigned this Mar 3, 2023
@lukebakken lukebakken added this to the 2.0.0 milestone Mar 3, 2023
@Gsantomaggio
Copy link
Member

That's great @lukebakken !

@lukebakken lukebakken force-pushed the lukebakken/write-to-pipeline-directly branch from 638369b to 1606f7b Compare March 3, 2023 15:17
@codecov
Copy link

codecov bot commented Mar 3, 2023

Codecov Report

Patch coverage: 95.69% and project coverage change: +0.30 🎉

Comparison is base (e42d8fe) 92.80% compared to head (1175caa) 93.11%.

❗ Current head 1175caa differs from pull request most recent head 9bbd2cd. Consider uploading reports for the commit 9bbd2cd to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
+ Coverage   92.80%   93.11%   +0.30%     
==========================================
  Files         102      102              
  Lines        8869     8810      -59     
  Branches      704      676      -28     
==========================================
- Hits         8231     8203      -28     
+ Misses        492      468      -24     
+ Partials      146      139       -7     
Impacted Files Coverage Δ
RabbitMQ.Stream.Client/Client.cs 92.84% <ø> (+0.92%) ⬆️
RabbitMQ.Stream.Client/CloseResponse.cs 82.35% <ø> (ø)
...bitMQ.Stream.Client/ConsumerUpdateQueryResponse.cs 85.00% <ø> (ø)
RabbitMQ.Stream.Client/CreditResponse.cs 70.00% <ø> (ø)
RabbitMQ.Stream.Client/DeclarePublisherResponse.cs 82.35% <ø> (ø)
RabbitMQ.Stream.Client/DeletePublisherResponse.cs 82.35% <ø> (ø)
RabbitMQ.Stream.Client/Deliver.cs 95.45% <ø> (-0.50%) ⬇️
RabbitMQ.Stream.Client/ICommand.cs 50.00% <ø> (ø)
RabbitMQ.Stream.Client/OpenResponse.cs 90.00% <ø> (ø)
RabbitMQ.Stream.Client/PartitionsQueryResponse.cs 91.30% <ø> (ø)
... and 34 more

... and 9 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@lukebakken lukebakken force-pushed the lukebakken/write-to-pipeline-directly branch from 4579c18 to 025a12a Compare March 12, 2023 02:19
@lukebakken lukebakken force-pushed the lukebakken/write-to-pipeline-directly branch from 12b2d60 to 9bbd2cd Compare May 9, 2023 14:36
@Gsantomaggio
Copy link
Member

Have you tried the perf test with this PR to see if there is any improvement?

@lukebakken lukebakken force-pushed the lukebakken/write-to-pipeline-directly branch 4 times, most recently from a960cb0 to 3cf0d51 Compare July 25, 2024 15:34
@Gsantomaggio Gsantomaggio added the v2 Version 2 label Sep 3, 2024
@Gsantomaggio
Copy link
Member

@lukebakken is this PR still valid?

@lukebakken
Copy link
Contributor Author

I'll re-visit this today or next week, @Gsantomaggio

@lukebakken lukebakken force-pushed the lukebakken/write-to-pipeline-directly branch 2 times, most recently from 9950e3d to 3b1011f Compare February 17, 2025 17:59
See:
https://blog.marcgravell.com/2018/07/pipe-dreams-part-3.html#writes-and-wrongs

* Fixup API validation
* Add assertion
* Fix a missing Advance/1 call
* Add FUTURE
* Replace span slices with range operator.
* Fix name violations

* Add missing `writer.Advance` calls

* Fix writing the command payload size.

* Add more missing `writer.Advance` calls

* Update dependency versions for CI
@lukebakken lukebakken force-pushed the lukebakken/write-to-pipeline-directly branch from 3b1011f to a4b902b Compare February 18, 2025 23:17
@lukebakken
Copy link
Contributor Author

@Gsantomaggio it's hard to tell if there is an improvement. RabbitMQ is running on a different machine than RabbitMQ.Stream.Client.PerfTest.exe

C:\Users\lbakken\development\rabbitmq\rabbitmq-stream-dotnet-client [main ≡ +0 ~1 -0 !]
> .\RabbitMQ.Stream.Client.PerfTest\bin\Debug\net8.0\RabbitMQ.Stream.Client.PerfTest.exe
Stream: dotnet-perftest
published 894976 msg/s in 2500 publish frames, confirmed 889056 msg/s, consumed: 889056 msg/sec total confirm frames 428 435 pending commands: 7359
published 1021926 msg/s in 2744 publish frames, confirmed 1017846 msg/s, consumed: 1021942 msg/sec total confirm frames 903 910 pending commands: 10000
published 1033984 msg/s in 2888 publish frames, confirmed 1036032 msg/s, consumed: 1036032 msg/sec total confirm frames 1435 1442 pending commands: 7962
published 1055387 msg/s in 2704 publish frames, confirmed 1053594 msg/s, consumed: 1055351 msg/sec total confirm frames 1909 1915 pending commands: 10000
published 1079940 msg/s in 2972 publish frames, confirmed 1079685 msg/s, consumed: 1079077 msg/sec total confirm frames 2384 2391 pending commands: 10000
published 1057715 msg/s in 2738 publish frames, confirmed 1057715 msg/s, consumed: 1057715 msg/sec total confirm frames 2777 2784 pending commands: 10000
published 1061470 msg/s in 2719 publish frames, confirmed 1061470 msg/s, consumed: 1061470 msg/sec total confirm frames 3215 3222 pending commands: 10000
published 1063800 msg/s in 2805 publish frames, confirmed 1064546 msg/s, consumed: 1064546 msg/sec total confirm frames 3619 3626 pending commands: 9999
published 1068018 msg/s in 2790 publish frames, confirmed 1067272 msg/s, consumed: 1069790 msg/sec total confirm frames 4137 4144 pending commands: 10000
published 1056811 msg/s in 2747 publish frames, confirmed 1058676 msg/s, consumed: 1058676 msg/sec total confirm frames 4637 4644 pending commands: 8324
published 1079435 msg/s in 2942 publish frames, confirmed 1077570 msg/s, consumed: 1079586 msg/sec total confirm frames 5123 5130 pending commands: 10000
published 1055574 msg/s in 2801 publish frames, confirmed 1055574 msg/s, consumed: 1059670 msg/sec total confirm frames 5575 5582 pending commands: 10000
published 1029673 msg/s in 2745 publish frames, confirmed 1029673 msg/s, consumed: 1031831 msg/sec total confirm frames 6014 6021 pending commands: 10000
published 1048833 msg/s in 2744 publish frames, confirmed 1048833 msg/s, consumed: 1052929 msg/sec total confirm frames 6457 6464 pending commands: 10000
published 1050935 msg/s in 2724 publish frames, confirmed 1050935 msg/s, consumed: 1051717 msg/sec total confirm frames 6940 6947 pending commands: 10000
published 1054744 msg/s in 2643 publish frames, confirmed 1057935 msg/s, consumed: 1057935 msg/sec total confirm frames 7387 7394 pending commands: 7299
published 1055353 msg/s in 2577 publish frames, confirmed 1052162 msg/s, consumed: 1053335 msg/sec total confirm frames 7829 7836 pending commands: 10000
published 1024708 msg/s in 2482 publish frames, confirmed 1024708 msg/s, consumed: 1025859 msg/sec total confirm frames 8309 8316 pending commands: 10000

C:\Users\lbakken\development\rabbitmq\rabbitmq-stream-dotnet-client [lukebakken/write-to-pipeline-directly ≡ +0 ~1 -0 !]
> .\RabbitMQ.Stream.Client.PerfTest\bin\Debug\net8.0\RabbitMQ.Stream.Client.PerfTest.exe
Stream: dotnet-perftest
published 882461 msg/s in 1874 publish frames, confirmed 872461 msg/s, consumed: 872461 msg/sec total confirm frames 442 449 pending commands: 10000
published 1021813 msg/s in 1944 publish frames, confirmed 1024874 msg/s, consumed: 1028970 msg/sec total confirm frames 927 934 pending commands: 9992
published 1039382 msg/s in 1750 publish frames, confirmed 1036321 msg/s, consumed: 1037497 msg/sec total confirm frames 1346 1353 pending commands: 10000
published 1062773 msg/s in 1813 publish frames, confirmed 1065303 msg/s, consumed: 1065303 msg/sec total confirm frames 1840 1847 pending commands: 7850
published 1060155 msg/s in 1816 publish frames, confirmed 1058766 msg/s, consumed: 1058860 msg/sec total confirm frames 2361 2368 pending commands: 10000
published 1078351 msg/s in 1734 publish frames, confirmed 1079166 msg/s, consumed: 1084420 msg/sec total confirm frames 2849 2856 pending commands: 9089
published 1016618 msg/s in 1782 publish frames, confirmed 1014662 msg/s, consumed: 1015686 msg/sec total confirm frames 3351 3358 pending commands: 10000
published 1063212 msg/s in 1652 publish frames, confirmed 1063212 msg/s, consumed: 1063212 msg/sec total confirm frames 3755 3762 pending commands: 10000
published 1068903 msg/s in 1909 publish frames, confirmed 1068903 msg/s, consumed: 1069848 msg/sec total confirm frames 4201 4208 pending commands: 10000
published 1045550 msg/s in 1729 publish frames, confirmed 1045550 msg/s, consumed: 1049243 msg/sec total confirm frames 4757 4764 pending commands: 10000
published 1063738 msg/s in 1865 publish frames, confirmed 1066252 msg/s, consumed: 1068288 msg/sec total confirm frames 5300 5307 pending commands: 9112
published 1022209 msg/s in 1583 publish frames, confirmed 1019695 msg/s, consumed: 1023791 msg/sec total confirm frames 5774 5781 pending commands: 10000
published 1058926 msg/s in 1825 publish frames, confirmed 1058926 msg/s, consumed: 1059438 msg/sec total confirm frames 6259 6266 pending commands: 10000
published 1017381 msg/s in 1699 publish frames, confirmed 1017381 msg/s, consumed: 1020239 msg/sec total confirm frames 6719 6726 pending commands: 10000
published 1025610 msg/s in 1688 publish frames, confirmed 1025610 msg/s, consumed: 1025610 msg/sec total confirm frames 7243 7250 pending commands: 10000
published 1071278 msg/s in 1923 publish frames, confirmed 1071278 msg/s, consumed: 1075374 msg/sec total confirm frames 7733 7740 pending commands: 10000
published 1068575 msg/s in 1794 publish frames, confirmed 1068575 msg/s, consumed: 1072671 msg/sec total confirm frames 8174 8181 pending commands: 10000
published 1041842 msg/s in 1829 publish frames, confirmed 1041842 msg/s, consumed: 1045938 msg/sec total confirm frames 8633 8640 pending commands: 10000
published 1060573 msg/s in 1717 publish frames, confirmed 1060573 msg/s, consumed: 1060573 msg/sec total confirm frames 9112 9119 pending commands: 10000
published 1066504 msg/s in 1834 publish frames, confirmed 1066504 msg/s, consumed: 1066504 msg/sec total confirm frames 9643 9650 pending commands: 10000
published 1049351 msg/s in 1743 publish frames, confirmed 1049351 msg/s, consumed: 1053447 msg/sec total confirm frames 10099 10106 pending commands: 10000
published 1048640 msg/s in 1915 publish frames, confirmed 1048640 msg/s, consumed: 1048640 msg/sec total confirm frames 10642 10649 pending commands: 10000
published 1045046 msg/s in 1736 publish frames, confirmed 1049992 msg/s, consumed: 1049992 msg/sec total confirm frames 11094 11101 pending commands: 5534
published 1067653 msg/s in 1714 publish frames, confirmed 1062707 msg/s, consumed: 1068055 msg/sec total confirm frames 11543 11550 pending commands: 10000
published 1076872 msg/s in 1834 publish frames, confirmed 1076872 msg/s, consumed: 1075665 msg/sec total confirm frames 12015 12022 pending commands: 10000

@lukebakken lukebakken marked this pull request as ready for review February 18, 2025 23:21
@lukebakken lukebakken removed this from the 2.0.0 milestone Feb 26, 2025
@lukebakken lukebakken assigned lukebakken and unassigned lukebakken Feb 26, 2025
@lukebakken lukebakken removed the v2 Version 2 label Feb 26, 2025
@lukebakken
Copy link
Contributor Author

I can't see any improvements with this code, in any of these areas:

  • Memory usage
  • Object allocations (this code allocates more)
  • Performance.

Closing!

@lukebakken lukebakken closed this Feb 26, 2025
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.

3 participants