簡體   English   中英

KahaDB db.data和ActiveMQ 5.6

[英]KahaDB db.data and ActiveMQ 5.6

我正在尋找與KahaDB相關的以下問題的答案。

我有一個使用ActiveMQ的應用程序,該應用程序接收大約500,000到100萬條消息,這些消息被寫入ActiveMQ隊列,消費者將它們撿起來。

我觀察到db.data文件大小在幾KB到幾乎600或700 MB之間變化。

我注意到,當db.data文件大小增加時,消息會卡住,迫使我關閉我的應用程序,重新啟動應用程序以讓新的用戶連接到代理以排空所有消息。

  1. 理想情況下db.data的大小應該是多少? 如果一個應用程序同時生成和使用,無論消息的數量如何,我認為db.data的大小應該很小。

  2. 為什么有時文件大小增加以及什么觸發db.data的文件大小增長?

我有ActiveMQ 5.6,我每個月至少看到這個問題2到3次。 在運行順暢的代理中,我發現db.data的文件大小是KB,而不是500 MB或700 MB。

以下是activemq.xml文件示例:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
   <!-- Allows us to use system properties as variables in this configuration file -->
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="locations">
         <value>file:${activemq.conf}/credentials.properties</value>
      </property>
   </bean>
   <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="/foo/activemq_5.6/data">
      <destinationPolicy>
         <policyMap>
            <policyEntries>
               <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">
                  <pendingSubscriberPolicy>
                     <vmCursor />
                  </pendingSubscriberPolicy>
               </policyEntry>
               <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb" useCache="false" />
            </policyEntries>
         </policyMap>
      </destinationPolicy>
      <managementContext>
         <managementContext createConnector="true" />
      </managementContext>
      <persistenceAdapter>
         <kahaDB directory="/foo/activemq_5.6/data/kahadb" />
      </persistenceAdapter>
      <systemUsage>
         <systemUsage>
            <memoryUsage>
               <memoryUsage limit="64 mb" />
            </memoryUsage>
            <storeUsage>
               <storeUsage limit="100 gb" />
            </storeUsage>
            <tempUsage>
               <tempUsage limit="50 gb" />
            </tempUsage>
         </systemUsage>
      </systemUsage>
      <transportConnectors>
         <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" />
      </transportConnectors>
   </broker>
   <import resource="jetty.xml" />
</beans>

通常,kahadb目錄具有尚未消耗的消息的段。 如果段中還有尚未消耗的消息,則它將保留整個段。 因此,如果您在任何隊列中都沒有任何內容,那么您通常不會在kaha目錄中擁有任何內容。

如果啟用了jetty控制台,則可以使用它來查看哪些隊列中包含消息。

如果您有時會慢慢消耗一些隊列,您可能希望將段大小從其默認值(例如33 meg)調整到更小的值以避免填滿磁盤/從配置文件中達到存儲限制)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM