Threading Models and Tuning : Event Preprocessor and Rete Worker Thread Options

Event Preprocessor and Rete Worker Thread Options
This aspect of the threading model deals with messages that arrive at destinations. For each destination you choose a threading model type:
The thread used carries execution to the post RTC phase, at which point execution is handed off to one of another set of threads, for writing to cache and backing store, if one is used.
In all threading models, event preprocessing is multi-threaded for high performance.
Diagrams in this section use as an example EMS messages, arriving at JMS destinations.
Each JMS destination creates a separate JMS Session internally, and creates a JMS thread and a dedicated JMS connection for itself.
All queues in all options are blocking, and FIFO (first in first out).
Additional tuning may be possible at the event level, depending on options available. For example the Enterprise Message Service server queue can be sized appropriately. This topic is outside the scope of TIBCO BusinessEvents documentation.
Note that events sent out in the event preprocessor phase are sent immediately and not in the post RTC phase.
Shared Queue and Threads
With this option, all destinations of all types share the TIBCO BusinessEvents system-wide queue and threads (JMS destination shown as an example). One pool of worker threads picks jobs from the shared queue. Execution continues on this thread through to post-RTC.
This is the default choice. It is most straightforward option The number of threads is not configurable, but the queue size is.
For more details, see notes for com.tibco.cep.runtime.scheduler.default.numThreads
Advantages
Disadvantages
Caller’s Thread
Uses the thread (and queue size) provided by the channel resource client (the Enterprise Message Service client, for example). There is one caller’s thread per destination. The same thread executes the RTC phase.
Advantages
The messaging library's thread does the message delivery, pre-processing and the Rete operations, so there is less context switching.
Disadvantages
Because each destination creates a JMS session, a session might be under used. On some operating systems, sockets and sessions could be very under-used.
Dedicated Workers
This option is similar to the Shared Queue option except that each destination has a dedicated thread pool and set of worker threads to process messages.
Each destination has its own queue (of a configurable size) and its own set of dedicated worker threads (also configurable).
Advantages
Each destination can be configured differently, to deal with correlation of events arriving at different rates in different destinations, or events that are correlated in different ratios, such as correlation of every tenth event from destination one with every other event from destination two.
Disadvantages