© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
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 ?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Messaging lib, RabbitMQ
C#CC# / help
6mo ago
RabbitMQ starting service issue
C#CC# / help
3y ago
✅ MassTransit with RabbitMQ Exception
C#CC# / help
3y ago
✅ Consuming REST API in MAUI
C#CC# / help
4y ago