Skip to content

PartitionedLoadBalancer

rmuthupandian edited this page Feb 11, 2015 · 1 revision

The PartitionedLoadBalancer is a specialized processor implementation that provides load balancing among its sinks. The events received by this processor are distributed evenly among its sinks by partitioning the events. The partition is created by composing a partition key composed of one or more event fields. A particular event sink is selected as follows

Event Sink = (H(f1)+H(f2)+H(fn)) % num sinks where f1, f2, fn are all event fields.

In a typical deployment this processor is injected between an Inbound channel and processors or between processing stages or between a processor and a set of outbound channels as shown in the figure below

#Screenshot

The ParitionedLoadBalancer is provisioned in Spring XML as follows

 <bean id="Paritionedloadbalancer"
	class="com.ebay.jetstream.event.processor.loadbalance.PartitionedLoadBalancer">
	<property name="eventSinks" ref="PartitionedloadbalancerSinks" />
	<property name="config" ref="PartitionedloadbalancerConfig" />
</bean>

<bean id="PartitionedloadbalancerConfig"
	class="com.ebay.jetstream.event.processor.loadbalance.PartionedLoadBalancerConfig">
	<property name="partitionKeys">
	    <map>
		<entry>
	  	  <key>
		      <value>Person</value>
 		  </key>
		  <list>
		     <!-- f1 & f2 are fields of event -->
		     <value>f1</value>
		     <value>f2</value>
		  </list>
					
		</entry>
	   </map>
      </property>
</bean>

<bean id="PartitionedloadbalancerSinks" class="com.ebay.jetstream.event.EventSinkList">
       <constructor-arg>
            <list>
               <ref bean="Processor1"/>
               <ref bean="Processor2"/>
               <ref bean="Processor3"/>
            </list>
        </constructor-arg>
</bean>
    
   
    
Clone this wiki locally