infosechoudini / influxdb-rs

Influx DB Rust Client Driver for Version 2.x
Apache License 2.0
1 stars 4 forks source link

Introduce a buffered write method #5

Open dangrazh opened 11 months ago

dangrazh commented 11 months ago

Hi

Thank for this library, this helped me a lot getting started with InfluxDB.

I have a specific use case, where I need to write thousands of data points per second to the database. In a frist test on my local machine (both the executable as well as InfluxDB are running on the same machine), inserting 2k data points into a single measurement took ~7 seconds. Reading the best practices, InfluxData states that writing batches of line protocol is more efficient than single lines. Therefore I implemented a "LineBuffer" as well as two new functions "write_point_buffered" and "write_points_buffered" into a local copy of your library. The resulting performance is ~0.235 seconds for the same set of 2k data points.

Would you be interested in discussing the topic of introducing a buffered write method into your library?

infosechoudini commented 11 months ago

Hey! Just do a PR and we can merge

infosechoudini commented 11 months ago

Add a few tests as well

dangrazh commented 11 months ago

Let me work on a proper implementation and then I'll do a PR. This might take a week or two, so bare with me.

infosechoudini commented 11 months ago

make sure to edit the README to include the capability

dangrazh commented 6 months ago

Sorry, had to put this aside for a while due to other priorities.

Question on the implementation of the various new functions in Client: Would you prefer to have separate new_with_batch_size functions or to pass the batch_size as an optional parameter the the existing new functions (as in add a function parameter batch_size: Option<usize> to the function singatures)?