CircleCI Maven Central Download


buffer-slayer is tool that buffers requests and send them in batch, of which client supports batch operation. Such as Spring-JdbcTemplate(batchUpdate), Redis(pipeline).

It has a queue that allows multiple producers to send to, and limited so to keep application away from Overflowing.

Also there is a fixed sized buffer to normalize data transportation. The buffer's data will be sent when it is full or a specific timeout is reached whichever comes first.

This project is inspired by zipkin-reporter-java.



bufferslayer-spring-jdbc is a buffer implementation of Spring's JdbcTemplate.

Queries are forwarded to the delegated JdbcTemplate and executed blockingly.

Updates directly goes to the reporter and returns a Promise immediately.



For native implementation:


For rx-java implementation:

AsyncReporterProperties reporterProperties = new AsyncReporterProperties()

BatchJdbcTemplate template = new BatchJdbcTemplate(yourFormerJdbcTemplate, reporterProperties);

MessageFuture<Integer> future = template.update(...);
future.addListener(f -> {
  // Your callback



This is where you configure all properties.


Here is a simple jdbc benchmark result on my MacBook Pro (Retina, 13-inch, Late 2013).

Using mysql 5.7.18, keeps executing a simple INSERT INTO test.benchmark(data, time) VALUES(?, ?);

Benchmark                                                        Mode    Cnt      Score       Error  Units
AsyncBatchJdbcTemplateBenchmark.high_contention_batched          thrpt   15  201510.137 ± 33755.347  ops/s
AsyncBatchJdbcTemplateBenchmark.high_contention_unbatched        thrpt   15     200.427 ±    52.891  ops/s
AsyncBatchJdbcTemplateBenchmark.mild_contention_batched          thrpt   15   52258.451 ±  7328.203  ops/s
AsyncBatchJdbcTemplateBenchmark.mild_contention_unbatched        thrpt   15     222.447 ±    25.284  ops/s
AsyncBatchJdbcTemplateBenchmark.no_contention_batched            thrpt   15   30075.936 ±  2797.128  ops/s
AsyncBatchJdbcTemplateBenchmark.no_contention_unbatched          thrpt   15     145.993 ±    27.643  ops/s



It sends requests to a queue and keeps flushing them to consumer.


Sending the messages that the buffer drained in batch.


A queue that bounded by a specific size. Supports multi producers in parallel. It supports overflow strategies as listed.

Strategies above are inspired by Akka stream.


Manages SizeBoundedQueue's lifecycle. Be responsible for queue creation and destruction.


A list with a fixed size that can only be drained when a timeout is reached or is full.