Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20B7010735 for ; Sat, 28 Feb 2015 16:38:15 +0000 (UTC) Received: (qmail 39128 invoked by uid 500); 28 Feb 2015 16:38:14 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 39076 invoked by uid 500); 28 Feb 2015 16:38:14 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 39064 invoked by uid 99); 28 Feb 2015 16:38:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Feb 2015 16:38:14 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tbain98@gmail.com designates 209.85.223.182 as permitted sender) Received: from [209.85.223.182] (HELO mail-ie0-f182.google.com) (209.85.223.182) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Feb 2015 16:38:10 +0000 Received: by iecrl12 with SMTP id rl12so38252312iec.4 for ; Sat, 28 Feb 2015 08:37:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=UIexezTz7TZZXlc5d7VGBo8ActnPGmZytxMURkF4XoU=; b=HUG5Qee19g/29n5AN+0hkoB+7mSU4opwlfw5yNeaM14nnhKTAwy6JR7P3Nbtz3sxnu 2yZfQFA45O6ahJh88Y8HWea764r7Du9FCxJ8bTAsd1jzplLpyHujoF7rrl0fDSGvhhAg f4uOhxX6Zq/b7nl4FYNXLAYUoNMd7VHm8HiSVZ6IiUVAgNWL2py9wC8RKf3fr5246rXh ZIsHgar2bLArOw4Q/wIzbOvHZ9VwT2yt3dliOzHkdYtwmfWfp2CdILsYH3YdktqAeBro iKWBeeV+vNKGgZQ713DQ6EQlirKnCzcC2KJ8ulKFto5tDqeUg0iUmogcMMscPUckBbzh tzCg== MIME-Version: 1.0 X-Received: by 10.50.72.108 with SMTP id c12mr10626516igv.27.1425141424671; Sat, 28 Feb 2015 08:37:04 -0800 (PST) Sender: tbain98@gmail.com Received: by 10.50.235.34 with HTTP; Sat, 28 Feb 2015 08:37:04 -0800 (PST) Received: by 10.50.235.34 with HTTP; Sat, 28 Feb 2015 08:37:04 -0800 (PST) In-Reply-To: References: Date: Sat, 28 Feb 2015 09:37:04 -0700 X-Google-Sender-Auth: d6EiJnHLTDWjtLXZaBdH4if6ztA Message-ID: Subject: Re: Several hundred messages occupies almost 30G storage From: Tim Bain To: ActiveMQ Users Content-Type: multipart/alternative; boundary=047d7bdc123c5f56aa0510289881 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bdc123c5f56aa0510289881 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable KahaDB can only delete a data file when every message in it can be deleted. If a single message is still needed, the whole file must be kept, and it doesn't perform any sort of compaction. And if the last message in a file that must be kept (because of some other message) has an ack in the next file, that next file must be kept itself. This can theoretically repeat forever if the messages happen to lay out just right in the data files, so a single old unprocessed message can theoretically prevent KahaDB from deleting any of its data files. There was a recently-fixed bug where the file with the ack was being improperly deleted, resulting in redelivery of the acked messages on broker restart; see https://issues.apache.org/jira/browse/AMQ-5542, which is fixed in 5.11.1 and 5.12.0. So the version you're running won't recognize the chain of files (if any) that need to be kept; with that fix, I'd expect you to hit your limit even faster. So your DLQish messages are in fact keeping alive any data files in which they exist. If they all came in as a batch, that would be just one file, but since they're spread out over time, that's probably a decent number of files. So you could do as Tim suggested and make a separate KahaDB store for these long-lived messages; that would solve this problem, but it's ultimately a workaround. Shrinking the size of each data file would help right now, but once you upgrade to 5.11.1 or 5.12.0 it wouldn't be able to guarantee that you didn't have to keep all the files; I'd focus on other options. So the real question is, why are you keeping your DLQ-like messages for 5 days? (This is probably the point where Art will chime in with "ActiveMQ is not a database.") You should be doing something with those messages quickly, not keeping them around for ages. If the messages get consumed immediately, the KahaDB files won't stick around long, and your problem is solved. So figure out how to change your application logic so you don't rely on messages staying on the broker for days; anything else is just a workaround for this flaw in your application logic. Tim One more question: will the same thing happen if I switch to leveldb? 2015-02-28 22:53 GMT+08:00 Rural Hunter : > I'm sorry I made a mistake. My storage is kahadb. We switched from leveld= b > to kahadb a while ago and I forgot that. > Thanks for the links. Now understand what happened! > > 2015-02-28 19:03 GMT+08:00 Tim Robbins : > >> Hi, >> >> Two suggestions for you: >> >> 1. Try decreasing the logSize parameter for LevelDB. You=E2=80=99ve have= a >> greater number of smaller log files, and a greater chance of each log file >> being garbage-collected. >> 2. With KahaDB, it=E2=80=99s possible to configure multiple KahaDB store= s, and to >> put your dead-letter type messages into a different store than everythin= g >> else to reduce overhead: >> http://blog.garytully.com/2011/11/activemq-multiple-kahadb-instances.htm= l >> < >> http://blog.garytully.com/2011/11/activemq-multiple-kahadb-instances.htm= l >> > >> Unfortunately it doesn=E2=80=99t appear that this applies to LevelDB yet= ! >> >> Regards, >> >> Tim >> >> > On 28 Feb 2015, at 7:27 pm, Rural Hunter wrote= : >> > >> > Hi, >> > >> > Activemq version 5.10.2, storage: leveldb. >> > >> > I have a queue which serves similiar function as dead letter queue. My >> > application process messages from another queue and if the processing >> > fails, it put the message into this queue. The messages are persistent >> and >> > average several KBs in size. My application processes many messages bu= t >> the >> > failed message count is very small, less than 100 a day. I noticed after >> > the application running for several days, my activemq storage becomes >> > almost full. I configured the storage to 30G. I checked the normal >> queues >> > and topics and there is no queue with large count of message. Most of >> them >> > are empty and some have only several messages. Only the failure messag= e >> > queue I metioned above has a few hundred messages(about 500) which are >> > accumulated in several days. >> > >> > I have no idea what takes so much storage. I checked the storage files >> and >> > found there are many db-xxxx.log with timestamp almost through the >> several >> > days. They are not consequent though. Some of the db-xxx.log files are >> not >> > there. So the file list is like this: >> > db-1000.log >> > db-1001.log >> > db-1003.log >> > db-1004.log >> > db-1005.log >> > db-1008.log >> > ... >> > I suspect the failed messages are in those db-xxx.log files so I just >> tried >> > to clear the failed message queue. Right after that I found those old >> > db-xxx.log disappeared and the storage usage went back to 2%. So it >> seems >> > clear that the about 500 failed messages took around 30G storage. But >> how >> > can it be? Those messages are very small in size and the total size of >> the >> > messsage should be no more than a few MBs. >> >> > --047d7bdc123c5f56aa0510289881--