[ https://issues.apache.org/jira/browse/DIRMINA-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16851752#comment-16851752 ]
Jonathan Valliere edited comment on DIRMINA-1114 at 5/30/19 11:29 AM: ---------------------------------------------------------------------- Here are the instructions that works for me. {noformat} Instructions for Ubuntu Linux $ sudo apt install linux-tools-common $ sudo apt install build-essential $ sudo apt install cmake $ sudo apt install openjdk-8-jdk-headless $ sudo apt install linux-tools-{your linux version} e.g. 4.15.0-50-generic Locate the installation path of the VM you wish to profile; in Ubuntu this is usually /usr/lib/jvm/* Create a working directory "perf-flamegraph" somewhere on your system. $ mkdir perf-flamegraph $ cd perf-flamegraph $ apt-get install cmake $ export JAVA_HOME=/path-to-your-jdk $ git clone --depth=1 https://github.com/jrudolph/perf-map-agent $ cd perf-map-agent $ cmake . $ make $ git clone --depth=1 https://github.com/brendangregg/FlameGraph You should have two folders "perf-map-agent" and "FlameGraph" Edit ./FlameGraph/jmaps and override JAVA_HOME and AGENT_HOME ======== ./FlameGraph/jmaps ============ JAVA_HOME=/path-to-your-jdk AGENT_HOME=/path-to-perf-agent ======================================== Execute your Java Application with -XX:+PreserveFramePointer using the same JVM that was identified earlier. (it has to be the same JVM) Create a new script "build-flamegraph" $ touch build-flamegraph $ chmod a+x build-flamegraph Paste the following into file build-flamegraph ======== ./build-flamegraph ============ #!/bin/bash sudo perf record -F 1000 -a -g -- sleep 30; sudo ./FlameGraph/jmaps sudo perf script | ./FlameGraph/stackcollapse-perf.pl | ./FlameGraph/flamegraph.pl --color=java --hash > flamegraph.svg sudo rm perf.data ======================================== Your working directory should look like FlameGraph perf-map-agent build-flamegraph $ sudo ./build-flamegraph {noformat} was (Author: johnnyv): Here are the instructions that works for me. {noformat} Instructions for Ubuntu Linux $ sudo apt install linux-tools-common $ sudo apt install build-essential $ sudo apt install cmake $ sudo apt install openjdk-8-jdk-headless $ sudo apt install linux-tools-{your linux version} e.g. 4.15.0-50-generic Locate the installation path of the VM you wish to profile; in Ubuntu this is usually /usr/lib/jvm/* Create a working directory "perf-flamegraph" somewhere on your system. $ mkdir perf-flamegraph $ cd perf-flamegraph $ apt-get install cmake $ export JAVA_HOME=/path-to-your-jdk $ git clone --depth=1 https://github.com/jrudolph/perf-map-agent $ cd perf-map-agent $ cmake . $ make $ git clone --depth=1 https://github.com/brendangregg/FlameGraph You should have two folders "perf-map-agent" and "FlameGraph" Edit ./FlameGraph/jmaps and override JAVA_HOME and AGENT_HOME ======== ./FlameGraph/jmaps ============ JAVA_HOME=/path-to-your-jdk AGENT_HOME=/path-to-perf-agent ======================================== Execute your Java Application with -XX:+PreserveFramePointer using the same JVM that was identified earlier. (it has to be the same JVM) Create a new script "build-flamegraph" $ touch build-flamegraph $ chmod a+x build-flamegraph Paste the following into file build-flamegraph ======== ./build-flamegraph ============ sudo perf record -F 1000 -a -g -- sleep 30; sudo ./FlameGraph/jmaps sudo perf script | ./FlameGraph/stackcollapse-perf.pl | ./FlameGraph/flamegraph.pl --color=java --hash > flamegraph.svg sudo rm perf.data ======================================== Your working directory should look like FlameGraph perf-map-agent build-flamegraph $ sudo ./build-flamegraph {noformat} > High CPU utilization because of Mina-core jar > --------------------------------------------- > > Key: DIRMINA-1114 > URL: https://issues.apache.org/jira/browse/DIRMINA-1114 > Project: MINA > Issue Type: Bug > Components: Core > Affects Versions: 2.1.2 > Reporter: Hrushikesh Agrawal > Assignee: Jonathan Valliere > Priority: Major > Attachments: 29thMay.zip, CPUAnalysys.zip, flamerelated.zip, > graph1_color.svg, htop.png, htop.png, nio-metal-example.svg, > step1_flamegraph.txt, threaddump_06_05_20191557137156089.log, > threaddump_06_05_20191557137173951.log > > > Hi, > We are have our own product through which we are trying to communicate with > LDAP server by using the mina-core-2.1.2.jar and api-all-1.0.3.jar jars. When > we have invalid connection parameter, and tried to get the connection, CPU > core utilization is 100%. > Then we have seen in JVisualVM and in Jprofiler that > "org.apache.mina.transport.socket.nio.NioSocketConnector" is in CPU more time. > We can see below in thread dump- > "NioSocketConnector-3" #152 prio=5 os_prio=0 tid=0x00007f95940d4000 > nid=0x77fb runnable [0x00007f956f1fe000] > java.lang.Thread.State: RUNNABLE > at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method) > at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269) > at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93) > at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86) > - locked <0x00000000ebdf89e8> (a sun.nio.ch.Util$3) > - locked <0x00000000ebdf89d8> (a java.util.Collections$UnmodifiableSet) > - locked <0x00000000ebdf88c0> (a sun.nio.ch.EPollSelectorImpl) > at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97) > at > org.apache.mina.transport.socket.nio.NioSocketConnector.select(NioSocketConnector.java:292) > at > org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:433) > at > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > We can see same issue with standalone java class and try to get the ldap > connection. Attaching couple of snapshot to understand the issue. > Please note this happens in Ubuntu and Centos. Also found same issue with > 2.0.21, 2.0.18 mina core jar. > Can someone please help me on this. > > Thanks, > Hrushi > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)