influxdata / influxdata/influxdb-java

Batching Enhancements

Open
#289 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
Dominant language
Java
Stars
1.2k
Forks
469
PR merge metrics
No merged PRs in 30d

Description

I'm building an InfluxDB producer that I'd like to guarantee at-least-once delivery for. My throughput requirements are high enough that batching is required. I was happy when I found BatchProcessor but then realized a couple of shortcomings that are preventing me from using it. I'd rather improve this library than create my own batch producer. Here's where the current batch implementation is falling short. Are any of these being worked on currently?

  1. There's no way to request the batch buffer to be flushed and not destroy the backing thread pool. The only option I see possible today without resorting to reflection is calling InfluxDB.disableBatch followed by InfluxDB.enableBatch to force a flush but that creates a new executor every time.
  2. BatchProcessor.write() is not thread safe and may be called concurrently from BatchProcessor.flush() on the current thread and the scheduled timer on the thread from the pool. This results in duplicate records being sent during flush().
  3. Batching records can silently fail. I'd like to provide a callback with each asynchronous write request that would be invoked once the point is sent or if an error was encountered while attempting to send it.
  4. The consistency level for all BatchPoints produced by the BatchProcessor is ConsistencyLevel.ONE. Direct control over the consistently level would be nice but ONE is a show stopper.

Some of the above are fairly substantial deviations in behavior from the current version. Would it be worthwhile for this to be a separate batch implementation rather than migrating the current version? Perhaps create a new asynchronous interface named InfluxDBAsync?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the existing BatchProcessor API and the InfluxDB.disableBatch and InfluxDB.enableBatch flow first. Define whether flushing without replacing the executor, asynchronous error callbacks, configurable consistency, and thread-safe writes belong in the current implementation or a new InfluxDBAsync interface. Done means the chosen design addresses the listed batching requirements without leaving delivery failures silent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.