Accessing JVisualVM in Order to Take CPU Sample Screenshots




 
Accessing JVisualVM in Order to Take CPU Sample Screenshots

Date Published: Feb 17,2017 Category: Product:Application_and_Webserver_Learn; Version:Learn_9_1_Q4_2016_3100_0_0_rel_107_401e,Learn_April_2014_9_1_201404_160205,Learn_October_2014_9_1_201410_160373,Learn_9_1_Q4_2015_9_1_201510_1171621,Learn_9_1_Q2_2016_3000_1_0_rel_52_991d   Article No.: 000064203

Product: Blackboard Learn

Release: 9.1

Introduction: When troubleshooting Blackboard Learn issues where performance is in question, you may find jVisualVM gives you a much clearer picture of where your application time is going than normal thread dumps or monitoring software such as Nagios or NewRelic.  Here is a quick guide for using jVisualVM when you have a Windows workstation, and you're connecting to a Unix-based app server.  

Note:  
If you have Windows application servers, you can simply run jvisualvm from Windows Explorer, and skip the PuTTY/VcXSrv.  You can also skip the PuTTY/VcXSrv installation if you have another SSH client that supports X11 and another X Windows server for Windows (there are many free versions available).
Functionality:

jVisualVM - The easy way

You need two software packages, which may or may not already be installed:

  1. SSH client like PuTTY (or another PuTTY-based client, like SuperPuTTY)
  2. X Server package for Windows.  
If you don't already have both, and/or are not familiar with these packages, Blackboard Learn Client Support recommends using the links below to download and install PuTTY and VcXSrv, as they require very little configuration, and are both very small:
  1. Install PuTTY client for your Windows workstation (http://www.putty.org/)

  2. Install Visual C++ Redistributable 2015 (08 or newer works, if you already have it): (https://www.microsoft.com/en-us/download/details.aspx?id=48145)

    • If you have issues installing Visual C++ Redistributable on Win7, see the 'Common Issues' section below.
    • Install VCXSrv (Visual C X Server) for Windows (https://sourceforge.net/projects/vcxsrv/)

    • Restart your machine after installing both (VcXsrv needs to set system variables)

    • Open PuTTY and enter the app server host name you want to profile

      Step 5
       
    • Start the VcXServ server in the background (Start > Search > VcCSrv > Enter)

      Step 6
       
    • In PuTTY, click Connection > SSH > X11 and check Enable X11 Forwarding.  Under Connection > SSH click Enable Compression

      Step 7a Step 7b
       
    • Open your SSH session, then run /usr/local/jdk1.8_0_91/bin/jvisualvm (replace with whichever JDK Learn is using)

      Step 8
       
    • Since X11 is enabled, you should get a GUI window for jVisualVM.  From here, find the main Tomcat JVM by looking for org.tanukisoftware.wrapper.WrapperStartStopApp:

      Step 9
       
    • Double click the WrapperStartStopApp, and you're in!  You can now take CPU samples, memory samples, observe the live heap, take thread dumps or heap dumps, or anything else you might need to do.  For example, we often use CPU Sample Snapshots to find out what classes are taking up the most time in a specific action.  To get a snapshot, click the "Sampler" tab:

      Step 10
       
    • Then click "CPU" to start sampling (do this DURING an issue):

      Step 11
       
    • After you've been sampling the issue for enough time and can see some items may be problematic, take a snapshot by clicking the Snapshot button:

      Step 12
       
    • Save the snapshot by clicking the new snapshot-generated tab and selecting Export to:

      Step 13
       
    • Save it to a location from which you can retrieve it, and use WinSCP or some other SFTP client of your choice to retrieve it:

      Step 14
       
    • Repeat as needed for further snapshots, thread dumps, etc. and submit the requested CPU Snapshots, App Snapshots, Heap dumps, or Thread dumps to support for investigation.

    Common Issues:

    If you have issues installing Visual C++ Redistributable on Windows 7, you may find the following resources useful:

    •  Visual C++ Stuck during install at Windows7_MSU_x64:  http://stackoverflow.com/questions/41233672/installation-microsoft-visual-c-redistributable-stuck-at-processing-window
      •  Install Update for Windows 7 for x64-based Systems (KB2999226)
      • Download the update KB2999226 for your OS edition from here: Update for Universal C Runtime in Windows

      • Manually install the KB2999226 as below:

      • o Find the path to the file Windows6.1-KB2999226-x64.msu from the folder C:\ProgramData\Package Cache\xxxxx\packages\Patch\x64, where xxxxx is the update ID, similar to "42D5BEC7DDFBD49E76467529CBC2868987BF8460"

        o Create a folder named ‘XXXX’ in that and execute following commands from Admin command prompt (start > cmd.exe > right click > run as admin)

        o wusa.exe Windows6.1-KB2999226-x64.msu /extract:XXXX

        o DISM.exe /Online /Add-Package /PackagePath:XXXX\ Windows6.1-KB2999226-x64.cab

        o Run the Visual C++ Redistributable with the repair option: vc_redist.x64.exe /repair