Java Broker Design - Slow Consumer DisconnectPage added by Martin RitchieSlow Consumer ProblemThe problem with slow consumers is that the broker must act as a buffer until they can catch up. However the broker does not have infinite resouces so it will fail if the consumer does not catch up. Work has already been done to help protect the broker from these situations by limiting producers on queues: Producer flow control. Consumers in the Java BrokerThere are three types of consumers that we need to investigate. Each one corresponds to a different use of a Queue. In addition to these three types we also have a number of Acknowledge modes that change the behaviour of the client and so also need special consideration. The tree types of queue we have to consider are:
JMS Durable SubscriptionsIn the case of durable subscriptions there is nothing simple we can do. The JMS spec requires the broker to keep all the messages. If a consumer here is disconnected and we are unable to hold all their messages then we need alternative strategies similar to the C++ broker: hard limit queue then drop/dead-letter, cyclic queue oldest are deleted. JMS QueuesIn the case of durable queues we are constrained just as we are for durable subscriptions. In the transient case we could perform the same limiting strategies as for the durable case however as the queue is transient we could be more aggressive in our cleanup. For example if we disconnected the slow consumer and had no consumers on the queue we could purge all the messages. This however would result in unexpected behaviour for our users who expect defined queue to hold their data. JMS Topics / Temporary queuesThe topic case is a simpler case to tackle at a first pass. The queue that is used is an exlusive, auto-delete transient queue. This means that the user is expecting the messages to be lost if they disconnect, so by detecting these queues that have reached a set threshold for message count, size or age the attached consumer session can be closed.
Change Notification Preferences
View Online
|
Add Comment
|