Hi,
I use ELK GA 5.0.0. I have 2 Logstash instances in my Linux box. Both of them are designed to consume from Kafka. One logstash consume from a Kafka topic while the other Logstash consume from 3 other Kafka topics. I have designed Logstash instances like this because the first topic has more data compared to other 3 topics. Using the top
command in Linux, I have noticed that my Logstash is taking a lot of CPU. I then tried Logstash's hot thread API and got the output like below;
{
"host" : "my-linux-box",
"version" : "5.0.0",
"http_address" : "192.168.0.1:9600",
"hot_threads" : {
"time" : "2017-03-07T10:22:03+00:00",
"busiest_threads" : 3,
"threads" : [ {
"name" : "Ruby-0-Thread-11",
"percent_of_cpu_time" : 80.56,
"state" : "waiting",
"path" : "/apps/ELK/Logstash/vendor/bundle/jruby/1.9/gems/logstash-input-kafka-5.0.5/lib/logstash/inputs/kafka.rb:191",
"traces" : [ "sun.misc.Unsafe.park(Native Method)", "java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)", "java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)", "java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)", "java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)", "java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)", "java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)", "org.jruby.javasupport.util.ObjectProxyCache$Segment.getOrCreate(ObjectProxyCache.java:449)", "org.jruby.javasupport.util.ObjectProxyCache.getOrCreate(ObjectProxyCache.java:164)", "org.jruby.javasupport.Java.getInstance(Java.java:385)" ]
}, {
"name" : "Ruby-0-Thread-12",
"percent_of_cpu_time" : 80.27,
"state" : "runnable",
"path" : "/apps/ELK/Logstash/vendor/bundle/jruby/1.9/gems/logstash-input-kafka-5.0.5/lib/logstash/inputs/kafka.rb:191",
"traces" : [ "java.lang.System.identityHashCode(Native Method)", "org.jruby.javasupport.util.ObjectProxyCache.hash(ObjectProxyCache.java:174)", "org.jruby.javasupport.util.ObjectProxyCache.getOrCreate(ObjectProxyCache.java:163)", "org.jruby.javasupport.Java.getInstance(Java.java:385)", "org.jruby.javasupport.Java.getInstance(Java.java:364)", "org.jruby.javasupport.JavaUtil.convertJavaToUsableRubyObject(JavaUtil.java:194)", "org.jruby.javasupport.JavaMethod.convertReturn(JavaMethod.java:513)", "org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:437)", "org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:300)", "org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:35)" ]
}, {
"name" : "Ruby-0-Thread-13",
"percent_of_cpu_time" : 80.21,
"state" : "blocked",
"path" : "/apps/ELK/Logstash/vendor/bundle/jruby/1.9/gems/logstash-input-kafka-5.0.5/lib/logstash/inputs/kafka.rb:191",
"traces" : [ "java.lang.ref.ReferenceQueue.poll(ReferenceQueue.java:107)", "org.jruby.javasupport.util.ObjectProxyCache$Segment.expunge(ObjectProxyCache.java:320)", "org.jruby.javasupport.util.ObjectProxyCache$Segment.getOrCreate(ObjectProxyCache.java:451)", "org.jruby.javasupport.util.ObjectProxyCache.getOrCreate(ObjectProxyCache.java:164)", "org.jruby.javasupport.Java.getInstance(Java.java:385)", "org.jruby.javasupport.Java.getInstance(Java.java:364)", "org.jruby.javasupport.JavaUtil.convertJavaToUsableRubyObject(JavaUtil.java:194)", "org.jruby.javasupport.JavaMethod.convertReturn(JavaMethod.java:513)", "org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:437)", "org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:300)" ]
} ]
}
}
It will be really helpful if somebody tell me why this is happening and how to fix this?
Thank you.