FioranoMQ offers a very high message throughput and low latency for non-persistent messages. The boost in delivery rates have been achieved through a series of algorithmic changes for multi-threaded scenarios, data-copy optimizations, transport layer enhancements, changes in flow-control semantics and by removing bottlenecks from the code.
FioranoMQ provides the following configuration options for tuning the publish-subscribe model:
Setting the Message Receipt Acknowledgement
In the DupsOkBatchSize mode, acknowledgement of receipt of message is sent after a configurable number of messages. By default this number is 20.
The steps below enable configuration of the Message Receipt Acknowledgement parameter using the Fiorano eStudio in offline mode:
- Open Fiorano eStudio.
- Select Tools > Configure Profile from the menu bar. Select the FioranoMQ folder, and click the Open button. FioranoMQ is now in offline mode.
- Navigate to FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem in the Profile Manager pane. The properties of the CommonConfig are displayed in the Properties pane.
- Select the ellipsis against the parameter DupsOkBatchSize. Type in the new value in the DupsOkBatchSize dialog box and click OK.
- Right-click the FioranoMQ domain in the Profile Manager pane and select the Save option from the shortcut menu.
Setting In-Memory Buffers for Subscribers
Another mechanism to manage flow-control is to increase the size of the In-Memory Buffers of topics and of subscribers with the Publisher slowdown algorithm option enabled. This will delay the initialization of publisher slowdown algorithm and increase the overall throughput. When the subscriber receives messages slowly, increasing the buffer size may lead to the Publisher slowdown algorithm not initializing.
This depends on the rate at which the messages are being published on the server. This is configurable using MaxConnectionBufferSize parameter through the Fiorano eStudio in offline mode. The default value of this variable is 2 MB. The default value can be increased to a higher value depending on the scenario.
Following steps enable you to configure this parameter:
- Open Fiorano eStudio.
- Select Tools > Configure Profile from the menu bar. Select the FioranoMQ folder, and click the Open button. FioranoMQ is now in offline mode.
- Navigate to FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem in the Profile Manager pane. The properties of the PubSub Manager are displayed in the Properties pane.
- Select the ellipsis against the parameter MaxConnectionBufferSize. Type in the new value in the MaxConnectionBufferSize dialog box and click OK.
- Right-click FioranoMQ domain in the Profile Manager pane and select the Save option from the shortcut menu.
Setting Parameters for New Pubsub Algorithm to Handle Slow Subscribes
In previous releases of FioranoMQ, there were no options available to disable the slowing down of the publisher when subscribers slow. In the default configuration, the publisher blocks messages by a predefined timeout and flow-control is activated.
From FioranoMQ SP2 onwards, the option of persisting messages to disk when the subscriber slows down, results in the fast subscriber not being affected even when publisher slowdown is disabled.
Below are the parameter that determines the different behaviors of the pubsub algorithm. Parameters can be configured from Fiorano eStudio (FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem pane.).
- PublishBackoffThreshold: This value indicates the size factor after which the Publisher needs to slow down. If its value is 0.6 and MaxPersistentSize is 1000MB, once the PSQ Size crosses 0.6*1000MB = 600MB then the Publisher will slow down.
Navigate to::
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > PublishBackoffThreshold.
By default this value is 0.6 which means 60% of PSQ.
- StoreMessageToDisk: When the session buffer in the client runtime overflows, the session state in the Server becomes passive. Thepublisher starts pushing the message into temporary persistent queues in the disk (for that particular session only). The slow subscriber will not receive messages until the client's session buffer can accommodate more messages. A normal subscriber keeps receiving the message since the publisher does not slow down.
Navigate to::
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > StoreMessageToDisk
The default value of this parameter is set to yes. The result of this parameter is not effective for non-persistent message that can be discarded.
If the default parameter is set to no, this parameter ensures that messages within the FioranoMQ Server never overflow onto a disk queue. This means that the messages are either delivered to the subscriber (assuming the subscriber is fast enough to pick them up), or they are dropped (once the internal buffer fills up).
- PublishWait: indicates the default time interval by which the publisher slows down when EnablePublisherSlowdown is set to yes. As the size of the Persistent Session Queue (PSQ) changes, the publisher blocking time also changes according to the exponential back-off algorithm.
Navigate to::
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > PublishWait
The default value of this parameter is 50 milliseconds (values less than or equal to 0 are not accepted).
- EnablePublisherSlowdown: If it's set to no, then the publisher does not slow down when sending messages to the persistent queue (PSQ). EnablePublisherSlowdown is used when publisher flow-control is needed due to many slow subscribers. This option should be carefully selected considering the different options as mentioned above. If this option is selected the publisher will slow down if PSQ size crosses the threshold defined by PublishBackoffThreshold. as described in the description of backoff algo. The slow down time starts from the value specified by another parameter called publishWait. It increases according to the slow down algorithm which depends on the size of the persistent message queue for every slow subscriber. This slow down time dynamically changes as and when persistent storage size changes. This option dynamically balances publisher slow down with the size of persistent message in the disk.
Navigate to:
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > EnablePublisherSlowdown
The default value of this parameter is yes. If the User does not want to have publisher flow-control, this parameter should be set to no.
- DropOldestMessage: If set to yes, the publisher first drops the oldest message from the persistent store and pushes the latest on the queue thereby ensuring the maximum size of persistent store is kept at all times.
Navigated to:
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > DropOldestMessage
The default value of this parameter is set to no. If the user wants to drop the latest message, when the size of total messages in the disk cross over a certain threshold, then this parameter should be set to its default value.
- MaxPersistentStoreSize: Indicates the maximum size of total messages stored in the persistent queue in the disk. Once the current size crosses over this threshold, the publisher starts dropping them if DropOldestMessage flag is set to no. If this flag is set to yes, the publisher first drops the oldest message from the persistent store and pushes the latest one. If it's value is set to -1, messages will be persistent till the server run out of disk space.
Navigated to:
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > MaxPersistentStoreSize
The default value of this parameter is 1073741824 bytes (1 GB).
- PublishWaitTimeChunks: If PSQ size reaches 95% of the maximum value, the publisher publishing persistent messages will be blocked till PSQ size reduces to 85%. The publisher should wait and periodically check the PSQ sizeto confirm it has reduced. This time interval at which publisher checks the PSQ can be controlled by this parameter.
Before checking the PSQ size, publisher will wait for MessagePublishTimeout/ PublishWaitTimeChunks in milliseconds for each iteration.
Navigated to:
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > PublishWaitTimeChunks
The default value of this parameter is 8 (values less than or equal to 0 are not accepted).
- IgnorePSQSizeForPersistentMessages: This flag determines the behavior when PSQ size exceeds MaxPersistentStoreSize. If this flag is set to true, persistent messages will still go onto the PSQ.
Navigated to:
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > IgnorePSQSizeForPersistentMessages
The default value of this parameter is Yes.
- MaxPublisherBlockTime: When EnablePublisherSlowdown is set to yes, this indicates the maximum time for which a publisher will wait while trying to push the messages to the PSQ after it has reached 95% of its maximum limit. This applies to all publishers.
Navigated to:
FioranoMQ > Fiorano > mq > pubsub > TopicSubSystem > MaxPublisherBlockTime
The default value of this parameter is 120000 milliseconds.
Points to Note:
- The Pubsub algorithm needs a new profile to run the server. The older profile has to be ported to the new profile. To port the older profile to the current profile, configurations need to be replicated manually. It server is recommended that the Server run with JVM heap size with the following setting to be made in fiorano_vars.bat/.sh:
- JVM_SERVER_ARGS=-server -Xms256m -Xmx512m (-Xms512m -Xmx1024m for enterprise operation)
- Non-persistent messages will always be dropped if PSQ size exceeds MaxPersistentStoreSize. However, non-persistent messages can persist till the Server goes out of disk space by setting its value to -1.
Flow control: Backoff algorithm will kick-in if PSQ size crosses PublishBackoffThreshold. By default, when 60% of the PSQ is used, every published call will be blocked for PublishWait (50ms by default). With every 5% increase in the PSQ size, publish call blocking time will be doubled. At the same time, the publish call blocking time will be halved with every 5% decrease. If 95% of the PSQ is used, the publish call will block calls for an infinite time. The publish call blocking time will reduce to 1600 ms if the PSQ size goes down to 85%.
The new back off algorithm can be disabled by setting EnablePublisherSlowdown to No.
The table below gives the default Blocking Time during various states of PSQ:
% of PSQ Used | Publish Block Time |
---|---|
60 % | 50 ms (PublishWait default) |
65 % | 100 ms |
70 % | 200 ms |
75 % | 400 ms |
80 % | 800 ms |
85 % | 1600 ms |
90 % | 3200 ms |
95 % | Block till PSQ size reduces to 85% |