The client act in a synchronous manner when BatchProcessorr#queue is full.
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- java
調査の方向性
issue で説明されている BatchProcessor のキューへのエンキュー経路から始め、BatchOptions と遅延する OkHttp インターセプターを使用した、提供されている JUnit の例で動作を再現します。デフォルトのバッチサイズに関する動作、特に 2000 回目の書き込みを確認し、キューが満杯の間も非同期書き込みがブロックされなくなった時点で issue は完了したものとします。
索引モデルが issue の本文から書いたものです。
説明
I went through the BatchProcessor implementation and noticed that when the batch processor is lagging behind and is not able to clear the queue, InfluxDB.write(Point p) becomes a blocking call even when one has configured it to write in an asynchronous manner.
This is happening because the queue instance is of type LinkedBlockingQueue and put(E e) is used for enqueueing which blocks the thread trying to enqueue.
IMO, this behaviour is very misleading, can block all the application threads who are trying to write whenever the write latencies on the influx-db server increases.
I am using the influxdb-java:2.15
Below is the sample Junit test to simulate this.
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Response;
import org.influxdb.BatchOptions;
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.Point;
import org.influxdb.dto.Query;
import org.junit.Test;
import java.io.IOException;
public class InfluxTest {
InfluxDB influxDB;
@Test
public void testConnection() {
connect();
for (int i=0;i<5000; ++i) {
long before = System.currentTimeMillis();
influxDB.write(Point.measurement("test").addField("a-field", 0).build());
long after = System.currentTimeMillis();
System.out.println(String.format("Time taken for writing %d times was %d", i, after-before));
}
}
private void connect() {
String influxDbConnectionURL = "http://localhost:8086";
influxDB = InfluxDBFactory.connect(influxDbConnectionURL, new OkHttpClient.Builder().addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
try {
Thread.sleep(10000);
System.out.println("interacted with influx");
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return chain.proceed(chain.request());
}
}));
influxDB.query(new Query("CREATE DATABASE " + '"' + "test" + '"'));
influxDB.setDatabase("test");
influxDB.enableBatch(BatchOptions.DEFAULTS.exceptionHandler(
(failedPoints, throwable) -> {
})
);
}
}
The default batch size is 1000, so the 2000th write call will be blocked for ~10000ms.
- 主要言語
- Java
- スター
- 1.2k
- フォーク
- 469
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
influxdata/influxdb-java のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
influxdata/influxdb-java#1012 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
influxdata/influxdb-java#1006 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
influxdata/influxdb-java#1005 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
influxdata/influxdb-java#999 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
influxdata/influxdb-java#970 ·
influxdata/influxdb-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenAPITools/openapi-generator#25014 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
AloisSeckar/demos-java#380 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openhab/openhab-core#5847 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
appsmithorg/appsmith#42297 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100