Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 45D9E11287 for ; Tue, 6 May 2014 15:02:18 +0000 (UTC) Received: (qmail 88233 invoked by uid 500); 6 May 2014 14:43:20 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 88153 invoked by uid 500); 6 May 2014 14:43:17 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 88079 invoked by uid 99); 6 May 2014 14:43:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2014 14:43:16 +0000 Date: Tue, 6 May 2014 14:43:16 +0000 (UTC) From: "Imran (JIRA)" To: dev@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (AMQ-5173) Kaha DB cleanup fails to reclaim disk space after some time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Imran created AMQ-5173: -------------------------- Summary: Kaha DB cleanup fails to reclaim disk space after some time Key: AMQ-5173 URL: https://issues.apache.org/jira/browse/AMQ-5173 Project: ActiveMQ Issue Type: Bug Affects Versions: 5.6.0 Reporter: Imran We are seeing an issue where a broker using Kaha DB will gradually increase its footprint on disk over time and never shrink back down again even when all queues are empty. The default cleanup settings will reclaim space at first but over time it seems the size of the data directory will grow and never shrink back down to its original size. I can reproduce this with a test that sends and consumes a large number of messages to a single queue (.net client, broker hosted on windows). The data file grows and will never shrink back down again. {code} [Test] public void ButLoadOfMessagesOnASingleQueue() { const int messagesPerProducerThread = 1000000; const int numberProducers = 1; const int numberConsumers = 3; var producersConsumers = new List(); var factory = new ConnectionFactory { AcknowledgementMode = AcknowledgementMode.Transactional, AsyncSend = true }; for (var i = 0; i < numberProducers; i++) { var producer = Task.Factory.StartNew(() => Send(factory, messagesPerProducerThread)); producersConsumers.Add(producer); } for (var i = 0; i < numberConsumers; i++) { var consumer = Task.Factory.StartNew(() => Consume(factory)); producersConsumers.Add(consumer); } Task.WaitAll(producersConsumers.ToArray()); } private void Send(IConnectionFactory connectionFactory, int noMessages) { var connection = connectionFactory.CreateConnection(); connection.Start(); var session = connection.CreateSession(); var destination = SessionUtil.GetDestination(session, GetQueueName(1)); var producer = session.CreateProducer(destination); for (var i = 0; i < noMessages; i++) { producer.Send(new ActiveMQTextMessage(i.ToString())); if (i%100 == 0) session.Commit(); } session.Commit(); connection.Close(); } private void Consume(IConnectionFactory connectionFactory) { var connection = connectionFactory.CreateConnection(); connection.Start(); var session = connection.CreateSession(); var destination = SessionUtil.GetDestination(session, GetQueueName(1)); var consumer = session.CreateConsumer(destination); var count = 0; while (true) { if (consumer.Receive(TimeSpan.FromSeconds(5)) == null) break; count++; if (count%100 == 0) session.Commit(); } session.Commit(); connection.Close(); } {code} -- This message was sent by Atlassian JIRA (v6.2#6252)