How to do memory profiling on a remote Java web application

I know that we can use tools like JProfiler, etc. Is there any tutorial on how to configure it to display memory usage only through remote monitoring?

Any idea?

+3
source share
5 answers

you have VisualGC, it is not very advanced, but you can see the memory usage of your application (garbage, old, permanent, etc.)

http://java.sun.com/performance/jvmstat/visualgc.html

to resume: you start the daemon monitoring on a remote computer ( http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jstatd.html , see security paragraph)

JAVA_HOME/bin/jstatd -J-Djava.security.policy=jstatd.all.policy

, jstatd.all.policy, :

    grant codebase "file:${java.home}/../lib/tools.jar" {   
permission java.security.AllPermission;
};

pid jps:

http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jps.html#jps

, visualgc:

visualgc the_pid@remote_machine_address
+8

YourKit, ( ).

- / script (catalina.sh tomcat) :

JAVA_OPTS="-Djava.awt.headless=true -agentlib:yjpagent -Xrunyjpagent:sessionname=Tomcat"

, YourKit ( catalina.sh):

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/yourkit/yjp-6.0.16/bin/linux-x86-32

YourKit .

+7

VM Java-, - -agentlib:jprofilerti=port=25000

JProfiler.

:

+3

Jprofiler. Tomcat Jprofiler.

  • Linux .bash_profile /root.
    jprofiller ( )

    .bash_profile file
    export LD_LIBRARY_PATH=/dsvol/jprofiler6/bin/linux-x86
    
  • Tomcat. catalena.sh bin.
    catelana.sh ( catalena.sh).

    export JPROFILER_HOME
    JAVA_OPTS="-Xms768m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m -Dfile.encoding=UTF8 -agentpath:/opt/Performance/jprofiler7/bin/linux-x86/libjprofilerti.so=port=8849 $CATALINA_OPTS"
    
  • bin, starup.sh

+1

VisualVM, , :

Java VisualVM

EDIT : I wrote a blog post on how to configure remote profiling through an SSH tunnel here:

http://kamilmroczek.com/2012/11/16/168787859/

0
source

Source: https://habr.com/ru/post/1698171/


All Articles