Ship faster with less risk. Get Optimizely Rollouts, free feature flags for developers. Create Free Account

Optimizely Blog

Tips & Tricks for Building Your Experimentation Program

Adding functionality like event batching to our Full Stack SDKs (versions 3.3.0+) is part of our commitment to creating a great developer experience. 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.

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()

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

Optimizely optimizely = Optimizely.builder()

Whether you are upgrading to the latest SDK versions or implementing it for the first time, we look forward to hearing about your experience with event batching! You can DM @Optimizely on Twitter to get in touch.

Optimizely X