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:
| • | Pack data as efficiently as possible within messages. |
| • | Use tight (rather than verbose) subject names and field names. |
| • | Use field identifiers rather than 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).
|
Notei |
However, you must use caution when implementing this strategy. Under some conditions, message objects involved in re-use can exhibit memory growth as a side-effect. To avoid this side-effect in C, use the functions |
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:
| • | tibrvsend
|
| • | tibrvlisten
|