Polling for Data

The TIBCO FTL library polls for available data during two phases of inbound message delivery:

  • In the receive phase, it polls to receive data from a transport’s data source.
  • In the dispatch phase, it polls to take messages from an event queue.

The paradigm is identical in both polling phases:

  1. Determine the time limit for polling, that is, the receive spin limit.
  2. Poll for available data.
    • If available, get the data and return it.
    • If not, continue polling until the time limit elapses.
  3. When the time limit elapses, block until data becomes available. Blocking relinquishes the CPU resource to do other work.

Threads and Latency

Polling code operates within a thread.

  • If the thread is already executing on a CPU core and polling for data, then when data becomes available, the thread immediately gets the data, without adding latency.
  • However, if the thread has blocked, the context switching time until it resumes execution adds to message latency. If it is crucial that your application minimize latency, then consider avoiding this situation by adjusting receive spin limit.