U
U
un1t2015-12-22 21:49:41
Node.js
un1t, 2015-12-22 21:49:41

Why does Rabbitmq start to slow down when sending a large number of concurrent requests?

Checking the performance of rabbitmq.
I send from 10 thousand to 100 thousand messages to the queue. Everything is fine, it is inserted at about 4 thousand / sec.
I increase the number to send from 100 thousand to 200 thousand. All rabbitmq starts to work very slowly, about 100-200 requests per second are inserted.

var amqp = require('amqplib');
var when = require('when');


amqp.connect().then(function(c) {
    var num = 100000;
    var cnt = 0;

    function mkCallback(i) {
        return function(err) {
            cnt++
            if (i % 1000 == 0) {
                console.log(i)
            }
            if (err !== null) {
                console.error('Message %d failed!', i);
            } else {
                //            console.log('Message %d confirmed', i);
            }
            if (cnt == num) {
                c.close()
            }
        }
    }

    c.createConfirmChannel().then(function(ch) {
        var queueName = 'mytest'
        var common_options = {
            durable: true,
            noAck: false
        };
        ch.assertQueue(queueName, common_options);
        for (var i = 0; i < num; i++) {
            ch.sendToQueue(queueName, new Buffer('blah'), {
                'deliveryMode': 2
            }, mkCallback(i));
        }
        //    ch.waitForConfirms().then(function() {
        //      console.log('All messages done');
        //      c.close();
        //    }, console.error);
    });
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abcyu, 2015-12-22
@abcyu

Why do you think RabbitMQ is to blame, not NodeJS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question