C
C#17mo ago
ProIcons

❔ [RabbitMQ][RabbitMq.Client] Low consuming rate.

Have anybody worked with RabbitMQ.Client ? I have this connection factory
.AddSingleton<IAsyncConnectionFactory, ConnectionFactory>(x =>
{
return new ConnectionFactory
{
DispatchConsumersAsync = true,
ConsumerDispatchConcurrency = 10,
// UseBackgroundThreadsForIO = true,
UserName = config.Username,
Password = config.Password,
HostName = config.Host,
Port = config.Port,
Ssl = config.SSL
? new SslOption(config.Host, enabled: true)
: new SslOption()
};
})
.AddSingleton<IAsyncConnectionFactory, ConnectionFactory>(x =>
{
return new ConnectionFactory
{
DispatchConsumersAsync = true,
ConsumerDispatchConcurrency = 10,
// UseBackgroundThreadsForIO = true,
UserName = config.Username,
Password = config.Password,
HostName = config.Host,
Port = config.Port,
Ssl = config.SSL
? new SslOption(config.Host, enabled: true)
: new SslOption()
};
})
and then i'm doing something like this:
public class A : AsyncDefaultBasicConsumer
{
public A(IModel model) : base(model)
{
}

public override Task HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey,
IBasicProperties properties, ReadOnlyMemory<byte> body)
{
return Task.CompletedTask;
}
}

using var connection = _connectionFactory.CreateConnection();
var channel = connection.CreateModel();
var consumer = new A(channel);
channel.BasicConsume(consumer, queueInfo.Name, autoAck: false, exclusive: true);
public class A : AsyncDefaultBasicConsumer
{
public A(IModel model) : base(model)
{
}

public override Task HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey,
IBasicProperties properties, ReadOnlyMemory<byte> body)
{
return Task.CompletedTask;
}
}

using var connection = _connectionFactory.CreateConnection();
var channel = connection.CreateModel();
var consumer = new A(channel);
channel.BasicConsume(consumer, queueInfo.Name, autoAck: false, exclusive: true);
Effectively i'm just consuming messages without acknowledging them. The consume rate is about 50/s. And it seems like it is hard capped there. Other tools can achieve from the same computer, same network, same remote rabbitmq, up to 400/s. Any ideas why i get such poor consuming rate ?
4 Replies
Omnissiah
Omnissiah17mo ago
why no ack?
ProIcons
ProIconsOP17mo ago
because i want to analyze DLQ messages and then return them to the DLQ and i want to analyze a queue with over 2.5million messages ~100gigs i arguably don't care about the body so much, but i care for the attached x-exception-stacktrace on the message headers
Omnissiah
Omnissiah17mo ago
so how about some info to debug the situation like what's the cpu usage of this code, did you look at the performances tool, did you try take timing of methods is this rabbitmq a single instance or a cluster
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server