Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Ring buffer channels are designed to avoid contention by placing events on a circular buffer implementation, in this case the LMAX Disruptor. Consumers running on different threads receive events from the buffer.

Image Added

Using Disruptor-based channels is simple. All that needs to be done is to specify the ring.buffer channel type as shown below:

...

Code Block
languagehtml/xml
public void class OrderPlacer ... {
 
   @Producer(target="OrderChannel")
   protected OrderChannel channel;
 
   public void placeOrder(Order order) {
      channel.publish(order);
   }
 
} 
Code Block
languagehtml/xml
public void class OrderTaker ... {
 
  @Consumer(source="OrderChannel")
  public void onOrder(Order order) {
      ....
  }
 
} 

...

Disruptor-based channels may be combined with messaging technologies such as The ZeroMQ Binding to create high performance distributed services. The FastQuote sample application demonstrates using ring buffer channels in conjunction with ZeroMQ and Google Protocol Buffers in a trading application that achieves microsecond processing times. For more details, see the respective binding sections.

 

Performance Tuning

By default, Fabric3 uses JDK proxies to create producer proxies. JDK proxies are less performant than handwritten code and allocate objects during invocation (for example, an array to create parameter values). Fabric3 provides an optional extension that uses bytecode generation to create proxies. This results in proxies that are as fast as handwritten code and do not allocate objects during invocation. To enable bytecode generation, the fabric3-bytecode-proxy module must be installed in the runtime. Its maven dependency coordinates are org.codehaus.fabric3:fabric3-bytecode-proxy.

...