ActiveMQヒープサイズが連続的に増加しており、最終的にメモリが不足します。まだ実行されているインスタンスのヒープダンプを取得し、多くのインスタンスを持つ次のクラスを取得しました(残りのクラスはほとんど最小です)。ここで間違っている可能性のあるものについてのポインタを探しています。メッセージを送信するためのActiveMQメモリリーク - ヒープ内のオブジェクトの理解
170866 instances of class org.apache.activemq.command.ProducerId
170526 instances of class org.apache.activemq.broker.jmx.AnnotatedMBean
170519 instances of class org.apache.activemq.command.SessionId
170518 instances of class org.apache.activemq.command.ConnectionId
170482 instances of class org.apache.activemq.broker.ProducerBrokerExchange
170482 instances of class org.apache.activemq.broker.jmx.ProducerView
170482 instances of class org.apache.activemq.command.ProducerInfo
170482 instances of class org.apache.activemq.state.ProducerState
コードスニペット:messageProducer.close()
が欠落しているため
MessageProducer messageProducer = session.createProducer(topic);
messageProducer.setTimeToLive(5 * 60 * 1000);
Message message = session.createObjectMessage(agentDebugEvent);
messageProducer.send(message);
はありますか?
プロデューサーを閉じることは、私が持っていたコードのバグではないと思います。すべてのメッセージに1つのプロデューサを使用するのは、メッセージを送信するたびに新しいプロデューサを作成することよりも利点がありますか? – pc70
コンシューマを作成するには、パフォーマンスセンドで1つのプロデューサを使用する必要がある場合、ヘビーウェイトの操作です。 –