Use VISUALVM to monitor Java applications in Azure cloud services

Source: Internet
Author: User
Tags visualvm jconsole

in doingJavadevelopment, we need to stress test the program before going live, to monitor the performance of the program thoroughly, to understandJVMof theCPU, Memory,GC,Classes, threading, and so on, or in the process of running the program on-line to diagnose problems or optimize programs,Java Profilingmore tools, such as commercialJprofiler,jclarityand so on, there's also freeJDKbring your own tools, such asVisualVM,JConsole,JMCwait, so when we're going toJavaThe application was deployed to theAzure Cloud Service, how do you use these tools for performance monitoring and tuning? This article takesOracle JDK 1.8Bring your ownVisualVMand theJMCto do an example.

?

let's look at it first . VisualVM The effect of running locally, my test environment started Eclipse , Tomcat and other applications, enter your Java install directory, open bin folder to find JVISUALVM program, and opens to see the main interface, has found the local running Java Program:

can see the tired out 3 a locally-run Java program, double-click PID to be 19256 of the Tomcat program, you can see the rich options, such as Overview , Monitor , Thread etc:

?

So the problem comes when we'll java web App deploy to Azure Cloud Service After, how to do JVM cloud service Span style= "font-family:arial" >rdp service, log on to the remote machine, and then open the local VISUALVM monitor, but we will find that while our java app can be accessed normally but cannot see tomcat jetty Application server process, also cannot monitor:

?

after I have been tested, I found that the main reason isCloud Servicein the StartJetty, theJavaRun as a daemon, so use theVisualVMin theCloud Servicecannot be detected in the local instance. VisualVMGetJVMThere are two ways of data,JMXorJstat, in theJava Apponce deployed in a cloud service, you need to explicitly specifyJMXparameters to open the service before it can be monitored, the following isStep by Stepthe steps:

?

This article assumes that you have mastered the quantity:

A . Deploy Java apps to Azure Cloud Services (http://cloudapps.blog.51cto.com /3136598/1699880)

B . Configure cloud service remote connections

?

  1. in the Eclipse in the Open your Azure Deployment Project, find package.xml:

  2. Locate the Jetty startup line and add the JMX parameter after Java start :

    -dcom.sun.management.jmxremote=true-dcom.sun.management.jmxremote.port=1099 (the port can be defined by itself)

    -dcom.sun.management.jmxremote.ssl=false

    -dcom.sun.management.jmxremote.authenticate=false

    Find Jetty Start line:

    ?

    the above JMX parameter is added to the Jetty in the startup parameter

  3. Save the changes and redeploy the project to Azure in the Cloud service:

  4. Connect to azure Cloud service instances, applications are typically deployed in "E:\approot" jdk bin directory, open VISUALVM :

    /li>
  5. You can see that jetty Any information about it, only VISUALVM a process that we deployed earlier in the jetty jmx VISUALVM source VISUALVM to make a simple configuration, select "File"- "Add JMX Connection" :

  6. in the Connection Input in 127.0.0.1 : 1099 (previously configured port number), Display Name Center A name you like, like Jetty , click OK completed.

  7. Double-click jetty You can see that you can already get through jmx monitor local java applied:

    ?

  8. end, VisualVM can already work, then we bang, by the way java Mission Control and jconsole Span style= "font-family: Microsoft Black" > also configured with:) also open e:\app\jdk_home\bin Span style= "font-family: Microsoft Jas Black", double-click JMC java Mission Control :

    Click "Click here to start using .... ", start using JMC

  9. in the same way you can see that in the JMC , only the VisualVM and JMCthat have been started are visible. Jetty . Select file-connect to Configure the JMX:

    in the main interface that appears, select "creat New Connection", go to the next page, configure the local Port in the main interface to 1099 , click "Test Connection" for testing, if everything is OK, then the test status is OK :

    Click Next, in the selection, select start JMX Consoleand click Finish:

    Then in the new interface you can use JConsole to monitor your application and see the metrics:

    ?

    ?

    we have configured how to Azure Configuring on cloud services VISULVM and the Jmc/jconsole make Java App performance monitoring, you can see most of the Windows Can be used on the same tool can be very good run in Azure Cloud services, and we can RDP easy to monitor.

Use VISUALVM to monitor Java applications in Azure cloud services

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.