Skip to content

How to do batch write with block api? #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lonelyleaf opened this issue Nov 11, 2020 · 3 comments · Fixed by #176
Closed

How to do batch write with block api? #174

lonelyleaf opened this issue Nov 11, 2020 · 3 comments · Fixed by #176
Milestone

Comments

@lonelyleaf
Copy link
Contributor

Proposal:
batch write data with block api

Use case:
I need import data from file and batch write with block api,but I notice that although WriteApiBlocking.writePoints( String bucket, String org, List<Point> points) accept collection of points,but the implementation of it write data one by one,which is too slow in my use case.

batch-write

By the way, when I tried your non-blocking api,sometime it create too many TIMED_WAITING thread,and casue oom finally.

threaddump-1604541290817.zip

@bednar
Copy link
Contributor

bednar commented Nov 11, 2020

@lonelyleaf thanks, we will take a look

@bednar
Copy link
Contributor

bednar commented Nov 12, 2020

PR with fix is prepared #176. Meanwhile you could use this workaround:

List<String> records = points.stream().map(Point::toLineProtocol).collect(Collectors.toList());

influxDBClient
    .getWriteApiBlocking()
    .writeRecords("b1", "org1", WritePrecision.NS, records);

@lonelyleaf
Copy link
Contributor Author

@bednar thanks

@bednar bednar added this to the 1.14.0 milestone Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants