Amazon Codeguru Profiler
Total Page:16
File Type:pdf, Size:1020Kb
Amazon CodeGuru Profiler User Guide Amazon CodeGuru Profiler User Guide Amazon CodeGuru Profiler: User Guide Copyright © Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. Amazon CodeGuru Profiler User Guide Table of Contents What is Amazon CodeGuru Profiler? ..................................................................................................... 1 What can I do with CodeGuru Profiler? ......................................................................................... 1 What languages are supported by CodeGuru Profiler? ..................................................................... 1 How do I get started with CodeGuru Profiler? ................................................................................ 1 Setting up ......................................................................................................................................... 3 Set up in the Lambda console ..................................................................................................... 3 Step 1: Sign up for AWS ..................................................................................................... 3 Step 2: Enable CodeGuru Profiler ......................................................................................... 3 Set up in the CodeGuru Profiler console ....................................................................................... 4 Step 1: Sign up for AWS ..................................................................................................... 3 Step 2: Create a CodeGuru Profiler profiling group ................................................................. 3 Step 3: Set permissions ...................................................................................................... 5 Step 4: Start CodeGuru Profiler in your application ................................................................ 7 Getting Started .................................................................................................................................. 8 Python sample application .......................................................................................................... 8 Prerequisites ...................................................................................................................... 8 Step 1: Create a profiling group ........................................................................................... 8 Step 2: Set up the virtual environment ................................................................................. 9 Step 3: Run the application ............................................................................................... 10 Step 4: Understanding the console ..................................................................................... 10 Cleanup ........................................................................................................................... 11 Java sample application ............................................................................................................ 11 Option 1: Quick demo ...................................................................................................... 12 Option 2: Complete demo ................................................................................................. 12 Integrating with JVM ........................................................................................................................ 16 Choosing the right integration option ......................................................................................... 16 Profiling your applications that run on AWS Lambda .................................................................... 17 All Java Runtimes ............................................................................................................. 17 Easier option for Java 8 (Corretto) and Java 11 (Corretto) Runtime .......................................... 19 Enabling the agent from the command line ................................................................................. 20 Installation ...................................................................................................................... 20 Configuration ................................................................................................................... 20 Supported runtime environments ....................................................................................... 21 Enabling the agent with code .................................................................................................... 24 Installation ...................................................................................................................... 24 Configuration ................................................................................................................... 25 Supported languages ........................................................................................................ 27 Java ................................................................................................................................ 27 Scala ............................................................................................................................... 27 Kotlin .............................................................................................................................. 28 Groovy ............................................................................................................................ 28 Jython ............................................................................................................................ 28 JRuby .............................................................................................................................. 28 Clojure ............................................................................................................................ 29 Integrating with Python .................................................................................................................... 30 Profiling your applications that run on AWS Lambda .................................................................... 30 Apply the CodeGuru Profiler function decorator to your handler function ................................ 30 Use AWS Lambda layers .................................................................................................... 31 Enabling the agent with code .................................................................................................... 32 Supported web components .............................................................................................. 27 Django ............................................................................................................................ 33 Flask ............................................................................................................................... 33 WSGI servers ................................................................................................................... 33 Enabling the agent from the command line ................................................................................. 34 iii Amazon CodeGuru Profiler User Guide Profiling Distributed systems ..................................................................................................... 35 Enabling logs ........................................................................................................................... 35 Working with unsupported AWS Regions ............................................................................................. 36 Working with profiling groups ........................................................................................................... 37 Creating a profiling group ......................................................................................................... 37 Deleting a profiling group ......................................................................................................... 37 Working with visualizations ............................................................................................................... 38 Types of visualizations .............................................................................................................. 38 Overview visualizations ..................................................................................................... 38 Hotspots visualizations ...................................................................................................... 41 Inspect visualizations ........................................................................................................ 41 Exploring visualization data ....................................................................................................... 41 Choosing my code in visualizations ..................................................................................... 42 Pausing over a frame ........................................................................................................ 42 Zooming in