Cookbook

  • 2020
  • 05/11/2020
  • Public Content

Profiling Applications in Amazon Web Services* (AWS) EC2 Instances

This recipe helps you set up a VM instance in AWS for performance profiling with
Intel® VTune™
Profiler
.

Ingredients

This section lists the hardware and software tools used for the performance analysis scenario.
  • Application:
    matrix
    . The application is used as a demo and not available for download.
  • Tools
    :
    Intel® VTune™
    Profiler
    (Beta) or Intel® VTune™ Amplifier 2019 - Hotspots analysis
    • For
      VTune
      Profiler
      downloads and product support, visit https://software.intel.com/en-us/vtune.
    • All the Cookbook recipes are scalable and can be applied to Intel VTune Amplifier 2018 and higher. Slight version-specific configuration changes are possible.
    • Intel® VTune™ Amplifier has been renamed to Intel® VTune™ Profiler starting with its version for Intel® oneAPI Base Toolkit (Beta). You can still use a standalone version of the VTune Profiler, or its versions integrated into Intel Parallel Studio XE or Intel System Studio.

Create and Configure a Virtual Machine Instance

  1. On the Amazon Web Services site, click
    Sign In to the Console
    to log in to your account.
    If you do not have an account, create it.
  2. Enter the Amazon EC2 Dashboard, select
    Compute > EC2
    .
  3. Click
    Launch Instance
    to create and configure your virtual machine with a wizard.
    In the configuration wizard, you can specify an OS and specification of the instance that fits your case (number of CPUs, memory, storage, and networking capacity).
  4. In
    Step 1: Choose an Amazon Machine Image (AMI)
    , select Ubuntu Server 18.04 LTSlick.
  5. In
    Step 2: Choose an Instance Type
    , select an instance and click
    Next: Configure Instance Details
    .
    Recommended system requirements for the
    VTune
    Profiler
    is 4 GB of RAM and at least 10Gb free disk space.
  6. In
    Step 3: Configure Instance Details
    , enable
    Auto-assign Public IP
    and click
    Next: Add Storage
    .
  7. In
    Step 4: Add Storage
    , increase the size of the storage device and click
    Next: Add Tags
    .
  8. [Optional] In
    Step 5: Add Tags
    , add a tag (for example,
    VTune Demo
    ), then click
    Review and Launch
    .
  9. In
    Step 7: Review Instance Launch
    , click
    Launch
    .
  10. Create a key pair:
    1. Select
      Create a new key pair
      and assign a name (for example, MyEC2Instance).
    2. Click
      Download Key Pair
      to download the key.
    3. Select
      Launch Instances
      to complete the setup.
      The instance is launched.
  11. Click
    View Instances
    .
    When the
    Instance State
    is updated to
    running
    , proceed to the next step.

Connect to the EC 2 Instance

Select the EC2 instance you created and click the
Connect
tab to connect to your instance via SSH.
PuTTY* does not natively support the private key format (
.pem
) generated by Amazon EC2. You should convert your private key (
.pem
) to the required PuTTY format (
.ppk
) using PuTTYgen before attempting to connect to your instance using PuTTY:
  1. Convert your private key:
    1. Start PuTTYgen.
    2. For the
      Type of key to generate
      , select
      SSH-1 (RSA)
      .
    3. Click
      Load
      and select your
      .pem
      file.
    4. Click
      Save private key
      to save the key in the format that PuTTY can use.
  2. Start PuTTY and specify a Public DNS for the instance and your private key (
    .ppk
    ) file in the
    Connection > SSH > Auth
    pane.
  3. Save this configuration and click
    Open
    .
    You are logged in to the instance.
You need to install the Xubuntu* desktop on your running instance and setup a VNC* Server if you want to access the system via VNC.

Configure the Instance for Profiling

Prepare the target instance for profiling by setting
/proc/sys/kernel/yama/ptrace_scope
to 0:
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

Run Hotspots Analysis

Run the Hotspots analysis using any of the following methods:
Run a remote collection from the locally installed
VTune
Profiler
using SSH:
Remote hardware event-based sampling analysis is not available in the AWS EC2 virtualized environment with an exception for the EC2 bare metal instances (i3.metal instance family) that allow direct access to bare metal infrastructure and full profiling capability of the
VTune
Profiler
.
  1. Create a project in the
    VTune
    Profiler
    .
    The
    Configure Analysis
    window opens.
  2. In the
    WHERE
    pane, select
    Remote Linux (SSH)
    and enter
    ubuntu@<
    name of putty configuration
    >
    for the
    SSH destination
    .
    At this point,
    VTune
    Profiler
    attempts to connect to the remote system and install the binaries necessary for collection to the specified folder.
  3. In the
    WHAT
    pane, specify the location of your application and its working directory.
  4. In the
    HOW
    pane, select the
    User-Mode Sampling
    collection mode for the Hotspots analysis (open by default).
  5. Click to start the collection.
    The results are automatically copied to your local system for analysis.
Run
VTune
Profiler
directly from the AWS instance:
  1. Install the
    VTune
    Profiler
    as described in the Installation Guide.
  2. Run the
    VTune
    Profiler
    . For example:
    sudo <
    vtune_install_dir
    >/vtune_profiler/bin64/vtune-gui
  3. Create a project.
    The
    Configure Analysis
    window opens.
  4. In the
    WHERE
    pane, select
    Local Host
    .
  5. In the
    WHAT
    pane, specify the location of your application and its working directory.
  6. In the
    HOW
    pane, select a preferred collection mode for the Hotspots analysis, for example:
    Hardware Event-Based Sampling
    .
  7. Click to start the collection.
    The analysis result opens in the default Hotspots by CPU Utilization viewpoint.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804