question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow EasyNetQ vs RabbitMq performance for Tasks.

See original GitHub issue

I created two the same simple programs, where count = 500:

In first case I’ve used RabbitMQ.Client.dll, 3.6.0.0

private static void TestManyTasksMq(int count)
        {
            ConnectionFactory connectionFactory = new ConnectionFactory();
            connectionFactory.Uri = "amqp://admin:1@localhost:5672";
            IConnection connection = connectionFactory.CreateConnection();

            var stopwatch = new Stopwatch();
            stopwatch.Start();
            var tasks = Enumerable.Range(1, count).Select(i =>
            {
                return Task.Factory.StartNew(() =>
                {
                    var channel = connection.CreateModel();
                    var arguments = new Dictionary<string, object> { { "x-expires", 60000 } };                    
                    var queueName = string.Format("test.{0}", Guid.NewGuid());
                    channel.QueueDeclare(queueName, false, true, true, arguments);
                    channel.QueueBind(queueName, "test.exchange", "test.new.*");                   
                });
            }).ToArray();

            Task.WaitAll(tasks);

            stopwatch.Stop();
            var s = stopwatch.Elapsed;

            Console.WriteLine("Time of MQ: {0:hh\\:mm\\:ss\\:fff}", s);
        }

In second case I’ve used EasyNetQ.dll, 0.63.5.454

private static void TestManyTasksEasyNetQ(int count)
       {
           using (var bus = RabbitHutch.CreateBus("host=localhost:5672;username=admin;password=1"))
           {
               var stopwatch = new Stopwatch();
               stopwatch.Start();

               IExchange exchange = bus.Advanced.ExchangeDeclare("test.exchange", ExchangeType.Topic);
               IAdvancedBus advancedBus = bus.Advanced;

               var tasks = Enumerable.Range(1, count).Select(i =>
               {
                   return Task.Factory.StartNew(() =>
                   {
                       var queueName = string.Format("test.{0}", Guid.NewGuid());
                       IQueue queue = advancedBus.QueueDeclare(queueName, false, true, true, expires: 60000);
                       advancedBus.Bind(exchange, queue, "test.new.*");                        
                   });
               }).ToArray();

               try
               {
                   Task.WaitAll(tasks);
               }
               catch (Exception ex)
               {
                   Console.WriteLine(ex.Message);
               }                

               stopwatch.Stop();
               var s = stopwatch.Elapsed;
               Console.WriteLine("Time of EasyNETQ: {0:hh\\:mm\\:ss\\:fff}", s);
           }
       }

Average results: 1: 10 seconds 2: 57 seconds

Why EasyNetQ has such slow performance? May be I do something wrong?

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:42 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
DenKncommented, Feb 15, 2017

Ok. I’ve create #666 issue.

1reaction
DenKncommented, Feb 13, 2017

the number of iterations 5000 “EasyNetQ” version=“1.0.1.475” targetFramework=“net451” Time of EasyNetQ: 00:00:19:721, and MAX iteration 00:00:12:332

So we get approximately the same result as for version=“0.63.6.463”. But it’s slower than MQ result: in two times (19 / 9 = 2) for all the time and in four times (12 / 3 = 4) for max iteration time. It’s not so good in my case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why rabbit is suprisingly slow?
I'm trying to implement messanging through the RabbitMQ. ... I watch at the queue I see that message consumption speed is only ~40...
Read more >
EasyNetQ - Publish Subscribe + Performance under heavy ...
In my organization we are evaluating the use of EasyNetQ for a new project. I personally used MassTransit earlier and new to EasyNetQ....
Read more >
13 Common RabbitMQ Mistakes and How to Avoid Them
Lazy queues create a more stable cluster, with more predictable performance. Your messages will not, without a warning, get flushed to disk.
Read more >
13 RabbitMQ Facts I Wish I Knew From the Start
2. Try a Framework · 3. Acknowledge Your Acknowledgment · 4. How Not to Lose Messages · 5. How to Really Not Lose...
Read more >
An introduction to RabbitMQ
If you need to use transactions, they are really slow, couple of orders of magnitude slower compared to regular AMQP usage.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found