Giter Site home page Giter Site logo

gfediere / aws-codeguru-profiler-demo-application Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/aws-codeguru-profiler-demo-application

0.0 1.0 0.0 54.27 MB

Example application demonstrating the features of Amazon CodeGuru Profiler

License: MIT No Attribution

Java 100.00%

aws-codeguru-profiler-demo-application's Introduction

Amazon CodeGuru Profiler demo application

Simple application for demonstrating the features of Amazon CodeGuru Profiler.

CodeGuru Profiler Console Screenshot

Quick demo

The results of this app are available to play with in the AWS console. There is no need to run the code, if you just want to see the results.

  1. Sign into the AWS console
  2. Head to CodeGuru Profiler and check out the demo app

How it works

The application does some basic image processing, with some CPU-heavy operations alongside some IO-heavy operations.

It consists chiefly of two components which run in parallel, the task publisher and the image processor.

CodeGuru Profiler runs inside the application, in the same way any real application would use it. It collects and reports profiling data about the application, ready to be viewed in the AWS console.

Checks the S3 bucket for available images, and submits the name of some of these images to the SQS queue.

Polls SQS for names of images to process. Processing an image involves downloading it from S3, applying some image transforms (e.g. converting to monochrome), and uploading the result back to S3.

Setup

Make sure you have installed the latest version of AWS CLI.

Setup the required components by running the following aws commands:

  1. Create two profiling groups in CodeGuru Profiler, named DemoApplication-WithIssues and DemoApplication-WithoutIssues
  2. Create an SQS queue
  3. Create an S3 bucket
  4. Install Maven (to build and run the code).
  5. Create/use an IAM role with permissions to access SQS, S3 and CodeGuru Profiler
aws configure # Set up your AWS credentials and region as usual
aws codeguruprofiler create-profiling-group --profiling-group-name DemoApplication-WithIssues
aws codeguruprofiler create-profiling-group --profiling-group-name DemoApplication-WithoutIssues
aws s3 mb s3://demo-application-test-bucket-1092734-REPLACE-ME
aws sqs create-queue --queue-name DemoApplicationQueue

How to run

The demo application can be run in two modes: with-issues and without-issues. Thus, you can compare how an optimized version of the application compares to one with performance issues.

  • To run the with-issues version, use the following instructions. Remember to replace YOUR-ACCOUNT-ID, YOUR-AWS-REGION and YOUR-BUCKET-REPLACE-ME as appropriate.
# These need to be set according to your setup:
export DEMO_APP_SQS_URL=https://sqs.YOUR-AWS-REGION.amazonaws.com/YOUR-ACCOUNT-ID/DemoApplicationQueue
export DEMO_APP_BUCKET_NAME=demo-application-test-bucket-1092734-YOUR-BUCKET-REPLACE-ME
export AWS_CODEGURU_TARGET_REGION=YOUR-AWS-REGION

# Run the demo!
export AWS_CODEGURU_PROFILER_GROUP_NAME=DemoApplication-WithIssues
mvn clean install # generates the DemoApplication-1.0-jar-with-dependencies.jar
java -javaagent:codeguru-profiler-java-agent-standalone-1.1.0.jar \
  -jar target/DemoApplication-1.0-jar-with-dependencies.jar with-issues
  • To run the without-issues version, use the following instructions. Remember to replace YOUR-ACCOUNT-ID, YOUR-AWS-REGION and YOUR-BUCKET-REPLACE-ME as appropriate.
# These need to be set according to your setup:
export DEMO_APP_SQS_URL=https://sqs.YOUR-AWS-REGION.amazonaws.com/YOUR-ACCOUNT-ID/DemoApplicationQueue
export DEMO_APP_BUCKET_NAME=demo-application-test-bucket-1092734-YOUR-BUCKET-REPLACE-ME
export AWS_CODEGURU_TARGET_REGION=YOUR-AWS-REGION

# Run the demo!
export AWS_CODEGURU_PROFILER_GROUP_NAME=DemoApplication-WithoutIssues
mvn clean install # generates the DemoApplication-1.0-jar-with-dependencies.jar
java -javaagent:codeguru-profiler-java-agent-standalone-1.1.0.jar \
  -jar target/DemoApplication-1.0-jar-with-dependencies.jar without-issues

Run this for a few hours to get plenty of data, along with a recommendations report.

Note: When running with-issues, you'll see plenty of Expensive exception, Pointless work and other debug gibberish being logged. This is expected! This is an example of a badly coded application, and you'll be able to see how these issues show up on the CodeGuru Profiler console.

So don't worry ๐Ÿ˜Ž -- we totally know about it.

License

This code is licensed under the MIT-0 License. See the LICENSE file.

aws-codeguru-profiler-demo-application's People

Contributors

amazon-auto avatar dependabot[bot] avatar gimki avatar ivoanjo avatar mirelap-amazon avatar olivergillespie avatar pandpara avatar rednes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.