I've set up a Kibana visualization starting from here:
I replaced the sample Apache web log data with a month's worth of my own live data and tweaked the logstash ingest process to work with a customized log format. I fired up Kibana and noticed that 30 seconds wasn't enough time for the visualization to load. So, I increased the timeout to 60 seconds and then the visualization usually loads but it takes maybe 45 seconds to do so.
Top shows me that the CPU is pegged at nearly 200% for the dual-core CPU during that load time.
I've run some curl commands to capture hot threads during the Kibana load but don't know what to look for in the output:
curl 'localhost:9200/_nodes/hot_threads' | grep "cpu usage"
59.6% (297.8ms out of 500ms) cpu usage by thread 'elasticsearch[Ringmaster][search][T#3]'
45.8% (228.8ms out of 500ms) cpu usage by thread 'elasticsearch[Ringmaster][search][T#4]'
45.5% (227.2ms out of 500ms) cpu usage by thread 'elasticsearch[Ringmaster][search][T#2]'
Nothing is logged in the ES log. The last time the load timed out, Kibana displayed this:
Error: Request Timeout after 60000ms
at http://.../bundles/kibana.bundle.js?v=9889:76425:16
And, this was logged by Kibana:
{"type":"response","@timestamp":"2016-06-28T21:38:02+00:00","tags":[],"pid":21585,"method":"post","statusCode":504,"req":{"url":"/elasticsearch/_msearch?timeout=0&ignore_unavailable=true&preference=1467149238306","method":"post","headers":{"host":"myhost:5601","accept":"application/json, text/plain, /","origin":"http://...","kbn-version":"4.5.0","user-agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36","content-type":"application/json;charset=UTF-8","referer":"http://.../app/kibana","accept-encoding":"gzip, deflate","accept-language":"en-US,en;q=0.8","x-forwarded-for":"172.16.22.139","x-forwarded-host":"...","x-forwarded-server":"...","connection":"Keep-Alive","content-length":"5312"},"remoteAddress":"198.125.128.129","userAgent":"198.125.128.129","referer":"http://.../app/kibana"},"res":{"statusCode":504,"responseTime":60006,"contentLength":9},"message":"POST /elasticsearch/_msearch?timeout=0&ignore_unavailable=true&preference=1467149238306 504 60006ms - 9.0B"}
I've taken a handful of the queries that Kibana is running and they each run in about a second.
I would very much appreciate suggestions on how to debug this performance problem. Thanks.