We are using Masstransit 8.0.2 with RabbitMQ(3.8.1 Erlang 22.1.5) and .Net6 . The message is being published from a TCPClient application. The message publishing time is increasing gradually and taking upto 30 minutes in publishing a single message. All the messages are being published in a background TCP receiver service. The data rate is fast as 60-70 messages are received at TCP client and being published to Rabbit using Masstransit asynchornously.
We have tried multiple configurations by playing with prefetch count and increasing and decreasing the consumers. We have also viewed the server cpu/memory/network utilization which all are under 50% on average Bus is being starting in application Startup
public static void AddServiceBus(this IServiceCollection services, IConfiguration configuration, int prefetchCount = 0, params Type[] consumers)
{
services.AddMassTransit(x =>
{
if (consumers != null && consumers.Any())
{
x.AddConsumers(consumers);
}
x.UsingRabbitMq((context, configurator) =>
{
var rabbitMqSettings = configuration.GetSection(nameof(RabbitMqConfiguration)).Get<RabbitMqConfiguration>();
configurator.Host(rabbitMqSettings.Host, d =>
{
d.Username(rabbitMqSettings.Username);
d.Password(rabbitMqSettings.Password);
});
configurator.ConfigureEndpoints(context);
configurator.UseRetry(b =>
{
b.Immediate(3);
});
if (prefetchCount > 0)
configurator.PrefetchCount = prefetchCount;
});
x.Configure<MassTransitHostOptions>(options =>
{
options.WaitUntilStarted = true;
options.StartTimeout = TimeSpan.FromSeconds(30);
options.StopTimeout = TimeSpan.FromMinutes(1);
});
});
}
private async Task<ErrorCode> PublishDataAsync(BaseData Data, string _messageGuid)
{
try
{
using var scope = _serviceProviderFactory.CreateScope();
var publishEndpoint = scope.ServiceProvider.GetRequiredService<IPublishEndpoint>();
var DataMessage = new DataMessage(Data);
await _publishEndpoint.Publish(DataMessage);
_logger.LogInformation("{messgeguid} Data Published to MassTransit", _messageGuid);
return ErrorCodes.SUCCESS;
}
catch (Exception e)
{
_logger.LogError(e, $"Message could not be published. {JsonConvert.SerializeObject(Data)}");
}
}
We are trying to increasing our message publishing rate. Our publishing message size is on avg 2kb.
I've also posted the question on StackOverFlow
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/aba8de94-a9ff-4b62-8cd5-fc2d0094f40cn%40googlegroups.com.