Skip to content

Bulk Writes in Write API #112

New issue

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

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

Already on GitHub? # to your account

Closed
SGStino opened this issue Jul 28, 2020 · 5 comments · Fixed by #113
Closed

Bulk Writes in Write API #112

SGStino opened this issue Jul 28, 2020 · 5 comments · Fixed by #113
Labels
bug Something isn't working
Milestone

Comments

@SGStino
Copy link

SGStino commented Jul 28, 2020

I've just migrated from InfluxDB.LineProtocol to this library using the WritePointsAsync method.

Code-wise, everything looks to work correctly. But first attempt at uploading something to InfluxCloud had me ..

WritePointsAsync "never" seemd to return. At least, never before i grew inpatient and killed the client.

After investigating the source code of the API, things became clear:
WritePointsAsync just is implemented as:

            foreach (var point in points) await WritePointAsync(bucket, org, point);

I'm not familiar yet with the 2.0 Protocols, howerver, i'd asume that there would be some kind of bulk upload option?
Because setting up an HTTP connection to the cloud for every single point sounds like it's going to be exactly as slow as i've experienced :)

As reference, my debug output:
Upload of 1000 points took 00:10:16.8700501

That's a little insane compared to the < 100ms against the InfluxDB.LineProtocol version I had before.

@bednar
Copy link
Contributor

bednar commented Jul 28, 2020

Hi @SGStino,

thanks for the issue, We will take a look.

Meanwhile you could use this workaround:

List<PointData> points = ...;

await _writeApi.WriteRecordsAsync(WritePrecision.Ns, points.Select(point => point.ToLineProtocol()).ToList());

Regards

@bednar bednar added this to the 1.11.0 milestone Jul 28, 2020
@bednar bednar added the bug Something isn't working label Jul 28, 2020
@bednar
Copy link
Contributor

bednar commented Jul 28, 2020

Hi @SGStino,

The issue is fixed in 1.11.0 milestone.

If you would like to use a preview version use our nightly build:

dotnet add package InfluxDB.Client --version 1.11.0-dev.1166

Regards

@SGStino
Copy link
Author

SGStino commented Jul 28, 2020

Ok, i'll give it a spin tomorrow.
The workaround works fine.
And from reviewing the commit, believe the result should be the same.

@SGStino
Copy link
Author

SGStino commented Jul 30, 2020

Spins like a kitten...
500ms for 500 points, 400ms for 1 point. + 200ms jitter.
The transatlantic connection does really amplify the problem.

Thanks for the quick fix!

@bednar
Copy link
Contributor

bednar commented Jul 30, 2020

You are welcome

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants