a plate of cookies

Sending events to Optimizely helps you understand the impact of your feature tests and event batching improves that process. The new experience scales efficiently and it is designed to be flexible for your application’s specific needs. Read on to learn more about how using the Event Processor for batching will make developers’ lives easier.

a group of cookies

Image courtesy of Rachel James, Creative Commons

3 Reasons to Batch Events

  1. Scale feature management, tests, and event tracking without friction. The new Full Stack Event Processor lets you batch events out-of-the-box to scale with the volumes that your application handles.
  2. Event batching is more efficient. While making it easier to do more, it is important that we are also empowering you to do it better. You will see fewer outbound requests to Optimizely when batching with the Event Processor, making it more efficient to send us more events.
  3. Dispatching events is now more flexible than ever.In addition to making event batching easier and more streamlined, we kept extensibility/reconfigurability in mind so you can use the Event Processor to meet your application’s specific needs. We allow you to change the defaults for batch size (maximum number of events sent at a time), and flush interval (maximum time before events are batched into a single call to Optimizely.).

Here’s a quick preview of how it works in the Java example below.

import com.optimizely.ab.Optimizely;
import com.optimizely.ab.config.HttpProjectConfigManager;
import com.optimizely.ab.event.AsyncEventHandler;
import com.optimizely.ab.event.BatchEventProcessor;
import java.util.concurrent.TimeUnit;
public class App {

public static void main(String[] args) {
String sdkKey = args[0];
EventHandler eventHandler = AsyncEventHandler.builder().build();

ProjectConfigManager projectConfigManager = HttpProjectConfigManager.builder()
.withSdkKey(sdkKey)
.build();

// Here we are using the builder options to set batch size
// to 50 events and flush interval to a minute.
BatchEventProcessor batchProcessor = BatchEventProcessor.builder()
.withBatchSize(50)
.withFlushInterval(1, TimeUnit.MINUTES)
.build();

Optimizely optimizely = Optimizely.builder()
.withConfigManager(projectConfigManager)
.withEventHandler(eventHandler)
.withEventProcessor(batchProcessor)
.build()
}
}