* mem -> batch(10) AvroEventSink -> AvroEventSource -> NullSink
*/
@Test
public void testAvroBatchSend10() throws IOException, InterruptedException {
Benchmark b = new Benchmark("nullsink");
b.mark("begin");
MemorySinkSource mem = FlumeBenchmarkHarness.synthInMem();
b.mark("disk_loaded");
FlumeConfiguration conf = FlumeConfiguration.get();
final AvroEventSource tes = new AvroEventSource(conf.getCollectorPort());
tes.open();
// need to drain the sink otherwise its queue will fill up with events!
Thread drain = new Thread("drain") {
public void run() {
try {
EventUtil.dumpAll(tes, new NullSink());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
drain.start(); // drain the sink.
b.mark("receiver_started");
final AvroEventSink tsnk = new AvroEventSink("0.0.0.0",
conf.getCollectorPort());
// make size happen first all the time.
final BatchingDecorator snk = new BatchingDecorator(tsnk, 10, 10000000);
snk.open();
b.mark("sink_started");
EventUtil.dumpAll(mem, snk);
b.mark("Avro sink to Avro source done");
// MB/s = B/us
b.mark("MB/s", (double) tsnk.getSentBytes()
/ (double) (b.getLastDelta() / 1000));
tes.close();
snk.close();
drain.interrupt();
b.done();
}