이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 26. Handling Slow Consumers


A slow consumer with a server-side queue can pose a significant problem for server performance. As messages build up in the consumer’s server-side queue, memory usage will increase. Consequently, the server may enter paging mode which can impact performance. Criteria can be set, however, so that consumers that do not acknowledge messages quickly enough can be disconnected from the server. In the case of a non-durable JMS subscriber, this means the server would remove the subscription and all of its messages, freeing up valuable server resources.

The calculation to determine whether or not a consumer is slow inspects only the number of messages that a particular consumer has acknowledged. It does not take into account whether flow control has been enabled on the consumer, or whether the consumer is streaming a large message, for example. Keep this in mind when configuring slow consumer detection.

Slow consumer checks are performed using the scheduled thread pool. Each queue on the server with slow consumer detection enabled will cause a new entry in the internal java.util.concurrent.ScheduledThreadPoolExecutor instance. If there are a high number of queues and the slow-consumer-check-period is relatively low, then there may be delays in executing some of the checks. However, this will not impact the accuracy of the calculations used by the detection algorithm. See Thread Management for more details about this thread pool.

Slow consumer handling is on a per address-setting basis. See Address Settings for more information on configuring an address-setting, and refer to the appendix for the list of address-setting attributes. There are three attributes used to configure the handling of slow consumers. They are:

slow-consumer-check-period
How often to check, in seconds, for slow consumers. The default is 5.
slow-consumer-policy

Determines what happens when a slow consumer is identified. The valid options are KILL or NOTIFY:

  • KILL will kill the consumer’s connection, which will impact any client threads using that same connection.
  • NOTIFY will send a CONSUMER_SLOW management notification to the client.

The default is NOTIFY.

slow-consumer-threshold
The minimum rate of message consumption allowed before a consumer is considered slow. The default is -1, which is unbounded.

Use the management CLI to read the current values for any of the attributes. For example, use the following command to read the current slow-consumer-policy for the address-setting with the name myAddress.

/subsystem=messaging-activemq/server=default/address-setting=myAddress:read-attribute(name=slow-consumer-policy)

Likewise, use the following example to set the same slow-consumer-policy.

/subsystem=messaging-activemq/server=default/address-setting=myAddress:write-attribute(name=slow-consumer-policy,value=<NEW_VALUE>)
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.