Skip to content
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

$write_api->write is really slow #23

Closed
paolss opened this issue Apr 17, 2020 · 2 comments · Fixed by #24
Closed

$write_api->write is really slow #23

paolss opened this issue Apr 17, 2020 · 2 comments · Fixed by #24
Labels
question Further information is requested
Milestone

Comments

@paolss
Copy link

paolss commented Apr 17, 2020

Hi is there a way for batching writes ?

Currently i have like 5mins aggregated meteics with 180520 lines - json file.
Im parsing it with php file_file_get_contents and then triying to $write_api in foreach loop...

But without write and just echo values it takes ->
real 0m0.658s
user 0m0.413s
sys 0m0.245s

With write_api it takes forever :) like 15 to 30 minutes

@paolss
Copy link
Author

paolss commented Apr 17, 2020

Basically all looks like this
$array = explode("\n", file_get_contents($file));
foreach ( $array as $line)
{
$obj = json_decode($line);
echo $obj->vlan."\n";
//$write_api->write("traffic,vlan=$obj->vlan,src_as=$obj->as_src,dst_as=$obj->as_dst,peer_ip_src=$obj->peer_ip_src,iface_in=$obj->iface_in,iface_out=$obj->iface_out bytes=$obj->bytes");
}

@bednar bednar added the question Further information is requested label Apr 20, 2020
@bednar bednar added this to the 1.3.0 milestone Apr 20, 2020
@bednar
Copy link
Contributor

bednar commented Apr 20, 2020

Hi @paolss,

Thanks for using our client.

I have been update a document about how to use a batching write and also added an example.

  1. Docs: https://github.com/influxdata/influxdb-client-php#batching
  2. Example: https://github.com/influxdata/influxdb-client-php/blob/master/examples/WriteBatchingExample.php

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
2 participants