Tibco EMS Flow Control

h1. TibcoEMSFlowControl

In some situations, message producers may send messages more rapidly than message consumers can receive them. The pending messages for a destination are stored by the server until they can be delivered, and the server can potentially exhaust its storage capacity if the message consumers do not receive messages quickly enough. To avoid this, EMS allows you to control the flow of messages to a destination. Each destination can specify a target maximum size for storing pending messages. When the target is reached, EMS blocks message producers when new messages are sent. This effectively slows down message producers until the message consumers can receive the pending messages. 

Enabling Flow Control

The flow_control parameter in tibemsd.conf enables and disables flow control globally for the EMS server. When flow_control is disabled (the default setting), the server does not enforce any flow control on destinations. When flow_control is enabled, the server enforces any flow control settings specified for each destination. See Chapter 7, Using the Configuration Files for more information about working with configuration parameters. 

When you wish to control the flow of messages on a destination, set the flowControl property on that destination. The flowControl property specifies the target maximum size of stored pending messages for the destination. The size specified is in bytes, unless you specify the units for the size. You can specify KB, MB, or GB for the units. For example, flowControl = 60MB specifies the target maximum storage for pending messages for a destination is 60 Megabytes. 

Enforcing Flow Control

The value specified for the flowControl property on a destination is a target maximum for pending message storage. When flow control is enabled, the server may use slightly more or less storage before enforcing flow control, depending upon message size, number of message producers, and other factors. Setting the flowControl property on a destination but specifying no value causes the server to use a default value of 256KB. 

When the storage for pending messages is near the specified limit, the server blocks all new calls to send a message from message producers. The calls do not return until the storage has decreased below the specified limit. Once message consumers have received messages and the pending message storage goes below the specified limit, the server allows the send message calls to return to the caller and the message producers can continue processing. 

If there are no message consumers for a destination, the server does not enforce flow control for the destination. That is, if a queue has no started receivers, the server cannot enforce flow control for that queue. Also, if a topic has inactive durable subscriptions or no current subscribers, the server cannot enforce flow control for that topic. For topics, if flow control is set on a specific topic (for example, foo.bar), then flow control is enforced as long as there are subscribers to that topic or any parent topic (for example, if there are subscribers to foo.*). 

Flow Control:

有时候EMS messgage producer 发送message会很快而message consumer则相对比较慢,然后就会有message pending在EMS QUEUE, EMS Server就有可能把存储内存耗尽,为了避免这种情况,EMS 提供了destination(queue, topic)的flow control, 每个destination可以指定一个最大的message size for EMS server 存储message,当destination里面pending的message达到了这个最大值以后, EMS server会阻塞message producer 发送新的message,直到message consumer能够接受pending的message

Enable Flow Control:

1. enable flow_control在EMS SERVER level, 修改  tibemsd.conf里面flow_control=enable

2. enbale destination 的flow_control, for queue: addprop queue TEST.QUE flowControl=10KB

Enforce Flow Control:

destination 的flowControl property指定了在这个destination上面pending的message的最大存储大小,default flowControl messsage size=256KB

当destination pending的message size接近指定的flowControl值时, EMS Server会阻塞message producer send message,直到pending mesage小于指定的flowControl值。

如果queue没有listner,或者topic没有subscriber和durable subsciber, 那么在queue和topic上设定的flowControl是不起作用的.

Flow Control, Threads and deadlock:

猜你喜欢

转载自rommal7090.iteye.com/blog/1453474
今日推荐