[rabbitmq-discuss] disk space not released after persistent messages are consumed

Jianing Hu hujn at polyvore.com
Tue Feb 8 01:27:07 GMT 2011


Hi,

RabbitMQ newbie here so apologies in advance if what I'm doing is
obviously wrong.

I'm experimenting with RabbigMQ 2.1.1 and it seems my persistent
message storage file keeps growing despite of messages being consumed.
Here's the code I used for testing. I'm using perl with Net::RabbitMQ

    use Net::RabbitMQ;
    my $mq = Net::RabbitMQ->new();
    $mq->connect("localhost", {
        user => 'guest',
        password => 'guest'
    });
    $mq->channel_open(1);
    $mq->queue_declare(1, 'test', {
        passive => 0,
        durable => 1,
        exclusive => 0,
        auto_delete => 0
    });

    my $data = 'foobar' x 200;
    for (1..100000) {
        $mq->publish(1, 'test', $data, {}, { delivery_mode => 2});
    }

    $mq->consume(1, 'test', {
        no_ack => 0
    });
    for (1..100000) {
        my $msg = $mq->recv();
        $mq->ack(1, $msg->{delivery_tag});
    }

After running this code I end up with a 3MB file in the
msg_store_persistent directory, even though rabbitmqctl list_queues
shows 0 messages in the queue. After restarting RabbitMQ server that
file grew by another 800KB. Any advice is greatly appreciated.

Thanks,
- Jianing


More information about the rabbitmq-discuss mailing list