MassTransit: Send performance is degraded
Is this a bug report?
Yes
Can you also reproduce the problem with the latest version?
Yes, the problem exists with the latest version, but not with v7.3.1
Environment
- Dotnet version: NET6
- Operating system: Win10
- IDE (Rider, VS Code, Visual Studio): Visual Studio 2022
Steps to Reproduce
- Write a test program to produce n items of messages to a queue
- Measure time
- Calculate throughput
Expected Behavior
Throughput should not be degraded with the newest version
Actual Behavior
Throughput is massively degraded with the newest version
Masstransit v7.3.1
10000 items in 00:00:01.1654773, throughput=8580 m/s
Masstransit v8.0.6
10000 items in 00:00:27.8208227, throughput=359 m/s
Reproducible Demo
https://gist.github.com/mbendtsen/80b98ee670e4ea102b668ebbbc5f4456
[Fact]
public async Task RawMasstransit_Producer()
{
// Setup
IBusControl busControl = serviceProvier.GetRequiredService<IBusControl>();
const int itemCount = 10000;
var messages = Enumerable.Repeat(new Message(), itemCount);
// Exercise
Stopwatch sp = Stopwatch.StartNew();
var uri = new Uri($"queue:test-queue");
var endpoint = await busControl.GetSendEndpoint(uri);
await endpoint.SendBatch(messages);
sp.Stop();
// Verify
double throughput = itemCount / sp.Elapsed.TotalSeconds;
output.WriteLine($"{itemCount} items in {sp.Elapsed:c}, throughput={throughput:#} m/s");
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (10 by maintainers)
It’s in the documentation: https://masstransit.io/documentation/configuration/transports/rabbitmq#configurebatchpublish
Publish/Send are the same for RMQ under the hood, so yes, it applies to both.