Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to AWS X-Ray

1,310 views

Published on

by KD Singh, Partner Solution Architect, AWS

  • Legitimate jobs paying $40/h Tap into the booming online job, industry and start working now! ●●● http://scamcb.com/ezpayjobs/pdf
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hey guys! Who wants to chat with me? More photos with me here 👉 http://www.bit.ly/katekoxx
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Introduction to AWS X-Ray

  1. 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. KD Singh, AWS Partner Solution Architect AWS X-Ray Debugging Applications at Scale March 2017
  2. 2. What to expect from the session  Overview  Use Cases  Concepts  How AWS X-Ray works  Getting Started  Demo  Pricing  Docs and Resources  Q&A
  3. 3. What is AWS X-Ray?
  4. 4. Debugging Applications
  5. 5. Debugging Applications  A development environment  Search through logs for clues to reproduce the issue  Set breakpoints in code to stop execution, and inspect variables and call stack  Add additional log statements as necessary and redeploy application  Repeat until the issue is fixed Traditional debugging involves: Traditional process of debugging doesn’t scale well to production applications or those built using a service-oriented, microservice, or serverless architecture It’s tedious, repetitive, and time consuming
  6. 6.  Simple to develop  Simple to test and debug  Simple to deploy  Simple to scale  Hard to iterate fast  Hard to scale efficiently  CI/CD time consuming and difficult  Reliability challenges — a problem with a single component can take down the whole app Monolithic vs. service-oriented applications Applications traditionally developed using a monolithic architecture Benefits: Drawbacks: Move to service oriented (microservices) architecture to overcome the drawbacks of a monolithic application architecture But microservices come with their own set of challenges
  7. 7. Challenges Services such as AWS Lambda, Amazon EC2 Container Service, AWS Elastic Beanstalk, AWS CloudFormation, etc. make it easier to deploy and manage applications consisting of hundreds of services Deploying and managing service-oriented applications can be more work compared to monolithic applications Still hard to debug application issues in production applications due to:  Cross-service interactions  Varying log formats across services  Collecting, aggregating, and collating logs from services
  8. 8.  Identify performance bottlenecks and errors  Pinpoint issues to specific service(s) in your application  Identify impact of issues on users of the application  Visualize the service call graph of your application Solution AWS X-Ray makes it easy to:
  9. 9. Use Cases
  10. 10. Visualize service call graph
  11. 11. Identify impact
  12. 12. Identify performance bottlenecks
  13. 13. Identify performance bottlenecks
  14. 14. Identify performance bottlenecks
  15. 15. Identify performance bottlenecks
  16. 16. Pinpoint issues
  17. 17. Pinpoint issues
  18. 18. Pinpoint issues
  19. 19. How does AWS X-Ray work?
  20. 20. X-Ray Concepts Trace End-to-end data related a single request across services Segments Portions of the trace that correspond to a single service Sub-segments Remote call or local compute sections within a service Annotations Business data that can be used to filter traces Metadata Business data that can be added to the trace but not used for filtering traces Errors Normalized error message and stack trace Sampling Percentage of requests to your application to capture as traces
  21. 21. X-Ray Service
  22. 22. X-Ray SDK Enables you to get started quickly without having to manually instrument your application code to log metadata about requests Available for Java, .NET, and Node.js Adds filters to automatically captures metadata for calls to:  AWS services using the AWS SDK  Non-AWS services over HTTP and HTTPS  Databases (MySQL, PostgreSQL, and Amazon DynamoDB)  Queues (Amazon SQS)
  23. 23. X-Ray Daemon Receives data from the SDK over UDP and acts as a local buffer. Data is flushed to the backend every second or when the local buffer fills. Available for Amazon Linux AMI, RHEL, Ubuntu, OS X, and Windows. Can be run anywhere as long as AWS credentials are provided (e.g.: EC2, ECS, on premise, developer machine, etc.)
  24. 24. X-Ray API  X-Ray provides a set of APIs to enable you to send, filter, and retrieve trace data  You can send trace data directly to the service without having to use our SDKs (i.e.: you can write your own SDKs for languages not currently supported)  Raw trace data is available using batch get APIs  You can build your own data analysis applications on top of the data collected by X-Ray
  25. 25. Segment Document Minimal example { "name" : "example.com", "id" : "70de5b6f19ff9a0a", "start_time" : 1.478293361271E9, "trace_id" : "1-581cf771-a006649127e371903a2de979", "end_time" : 1.478293361449E9 } Example showing an in-progress segment { "name" : "example.com", "id" : "70de5b6f19ff9a0b", "start_time" : 1.478293361271E9, "trace_id" : "1-581cf771-a006649127e371903a2de979", “in_progress”: true }
  26. 26. Sampling Configuration { "rules": { "move": { "id": 1, "service_name": "*", "http_method": "*", "url_path": "/api/move/*", "fixed_target": 0, "rate": 0.05 }, "base": { "id": 2, "service_name": "*", "http_method": "*", "url_path": "*", "fixed_target": 1, "rate": 0.1 } } } This example defines two rules. The first rule applies a five-percent sampling rate with no minimum number of requests to trace to requests with paths under /api/move The second overrides the default sampling rule with a rule that traces the first request each second and 10 percent of additional requests.
  27. 27. Getting Started
  28. 28. Agent installation (Amazon EC2 Linux) #!/bin/bash curl https://s3.dualstack.us-east-1.amazonaws.com/aws-xray-assets.us-east-1/xray-daemon/aws-xray- daemon-1.x.rpm -o /home/ec2-user/xray.rpm yum install -y /home/ec2-user/xray.rpm
  29. 29. Agent Installation (Amazon EC2 Windows)
  30. 30. Agent installation (Amazon ECS)
  31. 31. Application instrumentation (Node.js) //Add aws-xray-sdk package to package.json var XRay = require('aws-xray-sdk'); var AWS = captureAWS(require('aws-sdk')); … XRay.config([XRay.plugins.EC2]); XRay.captureHTTPs(http); XRay.setDefaultName('myfrontend-dev'); … app.use(XRay.express.openSegment()); app.get('/', function(req, res)… app.get('/blog', function(req, res)… app.use(XRay.express.closeSegment());
  32. 32. Pricing
  33. 33. X-Ray pricing Free during the preview. After that: Free tier  The first 100,000 traces recorded per month are free  The first 1,000,000 traces retrieved or scanned per month are free Additional charges  Beyond the free tier, traces recorded cost $5.00 per million per month  Beyond the free tier, traces retrieved or scanned cost $0.50 per million per month
  34. 34. Demo
  35. 35. Available in preview  Go to https://aws.amazon.com/xray to sign up for the preview.  Documentation: http://docs.aws.amazon.com/xray/latest/devguide/aws-xray.html  .NET Sample: https://github.com/awslabs/aws-xray-dotnet-webapp  Java Sample: https://github.com/awslabs/eb-java-scorekeep/tree/xray  Node.js Sample: https://github.com/awslabs/eb-node-express-sample/tree/xray The AWS X-Ray service is available in preview today.
  36. 36. Questions?
  37. 37. Thank you!

×