Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 17 Best Practices for Low Latency : Program Design Hints

Program Design Hints
These hints can help you design programs that minimize message latency.
Reduce Message Size
Minimize message size. Larger messages consume more network bandwidth, which can increase latency for all messages on the network.
Consider the following techniques:
Use tight (rather than verbose) subject names and field names.
Re-Use Message Objects
It takes time to create and destroy outbound message objects, and to populate them with data. You can reduce these costs by re-using a pool of pre-initialized messages, and modifying only a subset of their data fields (as needed).
 
*i
To avoid this side-effect in C, use the functions tibrvMsg_MarkReferences() and tibrvMsg_ClearReferences(). For further information, see Validity of Data Extracted From Message Fields, in TIBCO Rendezvous C Reference.
Reduce Input/Output
I/O activity slows programs. Minimize non-critical I/O, extensive logfile output and terminal output.
When logging is required for monitoring or auditing, shift the I/O burden to another computer to log messages without introducing a time penalty.
Avoid Feature Overhead
Some advanced features of TIBCO Rendezvous—such as fault tolerance, certified delivery, and distributed queues—involve additional overhead costs to applications that use them. These costs include I/O and protocol messages, which can have a large effect on latency.
Careful Memory Management
Memory management overhead can significantly slow program execution. Design programs carefully to avoid both explicit and hidden memory management costs.
The garbage collection feature in some programming languages can cause variability in data latency. When programming in such languages, avoid creating short-lived objects whenever possible.
Minimize Processing within Callbacks
Blocking and longing-running callback functions can delay delivery of other events. Avoid these behaviors.
When inbound messages require lengthy processing, shift the processing load asynchronously. Quickly extract data from the message, and process it in another thread.
Examples
Usage examples are incorporated within two programs:

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved