NOTE
StrongLoop Arc and slc are no longer under active development, and will soon be deprecated. Arc's features are being included in the IBM API Connect Developer Toolkit: Please use it instead.
Skip to end of metadata
Go to start of metadata

Icon

To profile CPU consumption, you must:

 

CPU profiling with slc

Icon

The CPU profiler is not designed to be kept running indefinitely; rather, turn it on for 5 to 30 seconds to get some quick insights into application performance.

To profile CPU consumption with slc, follow these steps:

  1. Run your application:

    This will start a local instance of StrongLoop Process Manager and deploy the application to it.  

  2. Get process and worker IDs:

    This lists the process ID of StrongLoop Process Manager and the worker IDs and process IDs of all the worker processes.  In the example above, there are four worker processes.  Notice that the Process Manager itself is running in process 44417.

  3. Start CPU profiling for a specific worker process; for example:

    Icon

    Let CPU profiling run while your application is under typical or high load to get meaningful CPU profile data.

  4. Stop CPU profiling with the cpu-stop command, for example:

    You can optionally provide a filename after the process/worker ID.  When you stop CPU profiling, slc saves the output to the current working directory to the file name.cpuprofile. If you don't provide the filename argument, by default it saves results to the file node.<workerID>.cpuprofile; in the above example, node.1.1.44418.cpuprofile.

  5. Stop your application:

    See slc ctl for more information.

  6. Start StrongLoop Arc to view the profile data.
  7. In Arc, click Profiler.
  8. Click File to load a local profile file.
  9. Click Load.
  10. Choose the .cpuprofile file you generated.
  11. The file will then be listed in in the Profiles list: click on it to view the CPU profile data, for example, as shown below.
    For information on viewing CPU profile data in Chrome DevTools, see Profiling JavaScript Performance.

Viewing CPU profile data

Icon

For more information on viewing CPU profiles in Chrome DevTools, see Profiling JavaScript Performance.

Now in your Chrome browser, click the icon in the upper right of the window and choose Tools > Developer Tools (on some systems, the menu item may be More tools):

Chrome will display Developer Tools in the lower part of the window.  Choose Profiles in the menu bar.  You'll see the Profiles page:

Click Load then choose the file you saved previously; in the example above, node.8197.cpuprofile.  The file will then appear under CPU PROFILES in the list on the left.  Click on it to view the CPU profiling data.

Click on the inverted triangle to choose the type of display:

Choose Chart to see a graph of CPU consumption:

Icon

A known issue in Node versions before 0.10.26 and Node 0.11.14 causes CPU consumption to be reported higher than it actually is.



  • No labels