chronograf icon indicating copy to clipboard operation
chronograf copied to clipboard

Loading the host list or any host dashboard is very slow

Open unixninja92 opened this issue 10 years ago • 14 comments

Loading the host list or any sub dashboard takes upwards of 30s and seems to put a larger load than I was expecting on our influxdb server. Whatever queries it is doing seem to be fairly inefficient when dealing with our telegraf db which contains 250k+ series and 1100+ measurements with ~120 active hosts.

Even once the hosts dashboard is loaded it takes another 20s+ to load the apps that each host has.

Once the results are cached somewhere it's generally much faster.

unixninja92 avatar Nov 22 '16 18:11 unixninja92

Currently, we are doing show series queries. @gunnaraasen do you have ideas about how we can optimize our queries? Here is the query: https://github.com/influxdata/chronograf/blob/62da746c98f1d68fe618db608999b134263c0dd0/ui/src/hosts/apis/index.js#L59

goller avatar Nov 22 '16 19:11 goller

The queries for the host page are currently

SHOW DATABASES
select mean(usage_user) from cpu where cpu = 'cpu-total' and time > now() - 10m group by host;
select mean("load1") from "system" where time > now() - 10m group by host;
select mean("Percent_Processor_Time") from win_cpu where time > now() - 10m group by host; 
select mean("Processor_Queue_Length") from win_system where time > now() - 10s group by host
show series from /^apache$|^consul_health_checks$|^cpu$|^disk$|^docker$|^elasticsearch_indices$|^haproxy$|^influxdb_database$|^influxdb_httpd$|^influxdb_queryExecutor$|^influxdb_write$|^kubernetes_node$|^kubernetes_pod_container$|^kubernetes_pod_network$|^kubernetes_system_container$|^system$|^mem$|^memcached$|^mongodb$|^mysql$|^netstat$|^nginx$|^nsq_channel$|^nsq_server$|^nsq_topic$|^ping$|^postgresql$|^processes$|^redis$|^riak$|^varnish$|^win_cpu$|^win_mem$|^win_net$|^win_system$|^win_websvc$/

@gunnaraasen Seems like we could at the very least add ORDER BY DESC LIMIT 1 to the system stats. As for the show series, we are trying to find all hosts that have some data from these measurements.

goller avatar Nov 22 '16 19:11 goller

We also have ~6 months worth of data so influx has to load old shards to find some of the old series with those measurements using the show series query.

unixninja92 avatar Nov 22 '16 19:11 unixninja92

Hi @unixninja92 would you be willing to run this command and let me know what the output is. influx -database <your database> -host <your influxdb host> -port <your influxdb port> -username <your username> -password <your password> -execute 'show series from /^apache$|^consul_health_checks$|^cpu$|^disk$|^docker$|^elasticsearch_indices$|^haproxy$|^influxdb_database$|^influxdb_httpd$|^influxdb_queryExecutor$|^influxdb_write$|^kubernetes_node$|^kubernetes_pod_container$|^kubernetes_pod_network$|^kubernetes_system_container$|^system$|^mem$|^memcached$|^mongodb$|^mysql$|^netstat$|^nginx$|^nsq_channel$|^nsq_server$|^nsq_topic$|^ping$|^postgresql$|^processes$|^redis$|^riak$|^varnish$|^win_cpu$|^win_mem$|^win_net$|^win_system$|^win_websvc$/' | wc -l

Also the output of time influx -database <your database> -host <your influxdb host> -port <your influxdb port> -username <your username> -password <your password> -execute 'show series from /^apache$|^consul_health_checks$|^cpu$|^disk$|^docker$|^elasticsearch_indices$|^haproxy$|^influxdb_database$|^influxdb_httpd$|^influxdb_queryExecutor$|^influxdb_write$|^kubernetes_node$|^kubernetes_pod_container$|^kubernetes_pod_network$|^kubernetes_system_container$|^system$|^mem$|^memcached$|^mongodb$|^mysql$|^netstat$|^nginx$|^nsq_channel$|^nsq_server$|^nsq_topic$|^ping$|^postgresql$|^processes$|^redis$|^riak$|^varnish$|^win_cpu$|^win_mem$|^win_net$|^win_system$|^win_websvc$/' > /dev/null

nhaugo avatar Nov 29 '16 21:11 nhaugo

The first command returns 57265 and the second returns 0.46s user 0.11s system 1% cpu 30.137 total.

unixninja92 avatar Nov 30 '16 19:11 unixninja92

@unixninja92 Any chance you could get us a cpu profile?

nhaugo avatar Nov 30 '16 21:11 nhaugo

@nhaugo That was run from my latptop. Our influxdb is running on an m4.large. Do you want me to run the second command from inside our influx docker container?

unixninja92 avatar Nov 30 '16 22:11 unixninja92

@unixninja92 I've got an idea thanks to @jwilder about how we can solve this issue. I'll schedule up some time to experiment with using the method I describe here: https://github.com/influxdata/chronograf/pull/672#issuecomment-265868510

goller avatar Dec 08 '16 22:12 goller

The host list is much faster now. The population of the apps column still takes a while and dashboards still take a long time to load.

unixninja92 avatar Dec 09 '16 15:12 unixninja92

yeah, the population of the apps column is kinda hairy. Would love something more precise than the show series ... command we are running. Even on our monitoring instance, that command returns 1.2 MB of data in 450 ms. I'm sure there are many other users with lots more data.

I don't know a better answer but the show series approach seems unsustainable to me

willpiers avatar Dec 29 '16 18:12 willpiers

Can we check that the optimizations that were added to the host list view were also added to the application dashboards?

nhaugo avatar Jan 04 '17 02:01 nhaugo

connect #682

russorat avatar Mar 01 '18 07:03 russorat

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 23 '19 11:07 stale[bot]

This issue has been automatically closed because it has not had recent activity. Feel free to reopen if this issue is still important to you. Thank you for your contributions.

stale[bot] avatar Jul 30 '19 11:07 stale[bot]