Data throttlingBoth BlazeDS and LiveCycle Data Services provide data throttling features that give you control over aspects of the server’s underlying messaging system. You use data throttling to limit the number of server-to-client and client-to-server messages that a Message Service or Data Management Service destination can process per second. You can also set absolute limits for the number of client-to-server and server-to-client messages allowed per second. Without data throttling, the server pushes messages to clients without any indication on how fast the clients are processing messages. Similarly, a high number of messages from Flex clients can overwhelm a server. Throttling is useful when the server could overwhelm slow clients with a high number of messages that they cannot process or the server could be overwhelmed with messages from clients. For server-to-client messages in LiveCycle Data Services, you can use adaptive throttling to message frequency limits based on the message processing rates of clients. You can also set policies that determine what happens to messages that exceed the specified maximum message limits. Note: In addition to these standard throttling features, a set of
advanced capabilities are available in LiveCycle Data Service only.
For more information, see Advanced data tuning.
Message frequency limitsControl the rate at which a Message Service or Data Management Service destination on the server sends messages to or accepts messages from Flex clients in the following ways:
Destination-level message frequencyYou specify client-to-server and server-to-client message frequency limits for a destination in the destination’s throttle-inbound and throttle-outbound elements. Use the max-frequency attribute to set the maximum number of client-to-server or server-to-client messages per second that the destination can process. Use the max-client-frequency attribute to set the maximum number of client-to-server or server-to-client messages per second that the destination can process to or from individual clients. The following example shows throttle-outbound and throttle-inbound elements with max-frequency and max-client-frequency attributes: ...
<destination id="MyTopic">
<properties>
<network>
<throttle-outbound policy="ERROR"
max-frequency="100" max-client-frequency="10"/>
<throttle-inbound policy="IGNORE"
max-frequency="100" max-client-frequency="10"/>
...
The max-frequency attribute of the throttle-outbound element indicates that the destination sends a maximum of 100 messages per second to the entire pool of Flex clients. The max-client-frequency attribute indicates that the destination sends a maximum of ten messages per second to individual Flex clients. The max-frequency element of the throttle-inbound element indicates that the destination processes a maximum of 100 client-to-server messages per second from the entire pool of Flex clients. The max-client-frequency attribute indicates that the destination processes a maximum of ten messages per second from individual Flex clients. Client-level message frequencyThe maxFrequency property of a client-side Consumer, MultiTopicConsumer, or DataService component lets you limit the number of messages the component receives from a destination. The server read this information and ensures that it limits the messages it sends to the maximum number of messages per second specified. The server sends up to the limit, but can send fewer messages depending on how many messages are available on the server to send. The maxFrequency property is set when the Consumer, MutiTopicConsumer, or DataService component subscribes. The following example sets the maxFrequency property of a Consumer component that you create in ActionScript: ...
<mx:Script>
<![CDATA[
var consumer:Consumer = new Consumer();
consumer.destination = "chat";
consumer.maxFrequency = 40;
consumer.subscribe();
]]>
</mx:Script>
...
You can also set the maxFrequency property of a Consumer, MultiTopicConsumer, or DataService component that you create in MXML as the following example shows: ... <mx:Consumer id="consumer" destination="chat" maxFrequency="40"/> ... MultiTopicConsumer message frequencyUnlike the standard Consumer component, the MultiTopicConsumer component supports multiple subscriptions. You can set a default value for the maxFrequency property of a MultiTopicConsumer component, and also set separate values for individual subscriptions. The following example shows a MultiTopicConsumer with a default maxFrequency value of 40 messages per second. One of its two subscriptions uses the default value, while the other uses a different maxFrequency value specified in the third parameter of the addSubscription() method. The first two parameters of the addSubscription() method specify the subtopic and selector, respectively. The selector value is null in this case. ...
<mx:Script>
<![CDATA[
var consumer:MultiTopicConsumer = new MultiTopicConsumer();
...
consumer.maxFrequency = 40;
// For this subscription, use the default maxFrequency of 40.
consumer.addSubscription("chat.subtopic1");
// Only for this subscription, overwrite the maxFrequency to 20.
consumer.addSubscription("chat.subtopic2", null, 20);
consumer.subscribe();
]]>
</mx:Script>
...
For more information about the MultiTopicConsumer component, see Multitopic producers and consumers. DataService message frequencyFor the DataService component, you specify the default value of the maxFrequency property as the following example shows: ...
<mx:Script>
<![CDATA[
...
var ds:DataService = new DataService("Meeting");
ds.maxFrequency = 20;
...
]]>
</mx:Script>
...
When you use a DataService component in manual routing mode (manual synchronization of messages), you can specify multiple subscriptions and subscription-level values for the maxFrequency property as the following example shows. As with the MultiTopicConsumer.addSubscription() method, the manualSync.consumerAdSubscription() method takes subtopic, selector, and maxFrequency in its three parameters. ...
<mx:Script>
<![CDATA[
...
var ds:DataService = new DataService("Meeting");
ds.autoSyncEnabled = false;
ds.manualSync.producerSubtopics.addItem("flex-room");
// Set the subscription level frequency to 10.
ds.manualSync.consumerAddSubscription("flex-room", null, 10);
ds.manualSync.consumerSubscribe();
ds.fill(…);
...
]]>
</mx:Script>
...
For more information about manual routing, see Manually routing data messages. Adaptive client message frequencyWhen you enable adaptive client message frequency, the server adjusts the frequency of messages sent from server to client while taking the client’s actual message processing rate into account. You specify the maximum number of messages per second that the frequency is incrementally increased or decreased. Add something about fact that the calculations the server does are different depending the type of endpoint you are using. For example, RTMP versus long polling AMF. To use adaptive client message frequency, you configure the adaptive-frequency property of the flex-client-outbound-queue-processor element in the flex-client section of the services-config.xml, as follows:
Data throttling policiesData throttling policies determine what happens to Message Service and Data Management Service messages that exceed the specified maximum message limits. Destinations can use the following throttling policies:
|
|