Broadcast Output Adapter Component Configuration File Configuration

22-2 Oracle Complex Event Processing Developers Guide

22.2 Scalability Components

Oracle CEP provides the following components that you can use to improve the scalability of your Oracle CEP applications: ■ Section 22.2.1, EventPartitioner ■ Section 22.2.2, ActiveActiveGroupBean

22.2.1 EventPartitioner

A com.bea.wlevs.channel.EventPartitioner provides a mechanism for partitioning events on a channel across its output event sinks as Figure 22–1 shows. Figure 22–1 Event Partitioner EPN This section describes: ■ Section 22.2.1.1, EventPartitioner Implementation ■ Section 22.2.1.2, EventPartitioner Load Balancing ■ Section 22.2.1.3, EventPartitioner Initialization ■ Section 22.2.1.4, EventPartitioner Threading ■ Section 22.2.1.5, EventPartitioner Restrictions For more information, see Section 23.1, Configuring Scalability With a Channel EventPartitioner .

22.2.1.1 EventPartitioner Implementation

Oracle CEP provides a default event property-based EventPartitioner that you can configure a channel to use. When you configure a channel to use the default EventPartitioner, you specify the name of an event property by which the channel partitions events. The default EventPartitioner calculates a hash key using the event property value’s Object.hashCode as input to an internal hash function. The hashkey number-of-listeners is used to calculate which listener will receive the event. This algorithm is based on the same algorithm used by HashMap to calculate in which bucket to place a new item. In practice, this means events with the same event property value are sent to the same listener. Note: The default event property-based EventPartitioner does not dispatch in Round Robin fashion. Understanding Scalability 22-3 Optionally, you can create your own event partitioner instance and configure a channel to use it instead to customize how events are dispatched to the channel’s listeners. For more information, see: ■ Section 23.1.1, How to Configure Scalability With the Default Channel EventPartitioner ■ Section 23.1.2, How to Configure Scalability With a Custom Channel EventPartitioner

22.2.1.2 EventPartitioner Load Balancing

When using an event partitioner channel, if you want to perform load balancing, then each listener must be identical. Otherwise, listeners need not be identical.

22.2.1.3 EventPartitioner Initialization

By default, the Oracle CEP server initializes each event partitioner on deployment and will re-initialize event partitioners on re-deployment by invoking the EventPartitioner method activateConfiguration is before ActivatableBean.afterConfigurationActive and before your EventPartitioner class’s partition method is invoked.

22.2.1.4 EventPartitioner Threading

Table 22–1 lists the threading options you can use with an event partitioner channel.

22.2.1.5 EventPartitioner Restrictions

When configuring a channel to use an event partitioner, consider the following restrictions: ■ Batching is not supported when you configure a channel with an event partitioner. Table 22–1 Event Partitioner Channel Threading Options Threads Allocated In Description When to Use Channel ■ Channel max-threads set to the number of listeners. Usually acceptable if conversion of the external message format into the internal event format is inexpensive. Lets the multithreading be controlled at the channel granularity. Some channels may require a higher number of threads than others due to differences in volume. Adapter ■ Channel max-threads set to 0. ■ Implement a multi-threaded adapter with at least on thread per partition listener. Usually preferable if conversion of the external message format into the internal event format is expensive. This approach is best when the adapter is multithreaded and the inbound event rate is high enough that the adapter becomes a bottleneck unless multiple threads can be used to scale the inbound processing. Note: In either approach, event order cannot be guaranteed. This is true whenever multiple threads are used.