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.

DEV204_Debugging Modern Applications Introduction to AWS X-Ray

442 views

Published on

Analyzing and debugging production distributed applications built using a service oriented, microservices, or serverless architectures is a challenging task. In this session, we introduce AWS X-Ray, an AWS service that makes it easier to identify performance bottlenecks and errors, pinpoint issues to specific services in your application, identify the impact of issues on application users, and visualize the service call graph and the request timelines for your applications. We will also showcase a customer, Chick-fil-A and how they have adopted AWS X-Ray to play a role throughout the microservice lifecycle in order to ensure quality, transparency, and operational visibility for their services on AWS

  • Be the first to comment

DEV204_Debugging Modern Applications Introduction to AWS X-Ray

  1. 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS re:INVENT Debugging Modern Applications: Introduction to AWS X-Ray A b h i s h e k S i n g h ( A W S ) A l a i n N i c o l e t ( C h i c k - f i l - A ) D E V 2 0 4 N o v e m b e r 2 8 , 2 0 1 7
  2. 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What to Expect from the Session  Overview  Concepts  Use cases  Getting started  Customer story  Q&A
  3. 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Debugging Applications
  4. 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Traditional Debugging Developer Local Test Developer Add Breakpoints Add Log Statements
  5. 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monolithic vs. Service-Oriented Architecture Service-Oriented Architecture Monolithic
  6. 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The traditional process of debugging doesn’t scale well for production applications or those built using a service- oriented, microservice, or serverless architecture It’s tedious, repetitive, and time consuming
  7. 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Log-Centric Approach service 1 logs service 2 logs service 3 logs user
  9. 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. User-Centric Approach user Amazon DynamoDB Amazon SQS queue Frontend API
  10. 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Identify Performance Bottlenecks How Does AWS X-Ray help? Pinpoint Specific Service Issues Identify Errors Identify Impact to Users
  11. 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Concepts
  12. 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. X-Ray Concepts user Amazon DynamoDB table Amazon SQS queue Frontend API
  13. 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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
  14. 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Use Cases
  15. 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Visualize Service Call Graph
  16. 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Identify Impact
  17. 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Pinpoint Issues
  18. 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Pinpoint Issues
  19. 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Pinpoint Issues
  20. 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Identify Performance Bottlenecks
  21. 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Identify Performance Bottlenecks
  22. 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Identify Performance Bottlenecks
  23. 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Identify Performance Bottlenecks
  24. 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda (Initialization)
  25. 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda (Existing Container)
  26. 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda (Exceptions)
  27. 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda (Exception Details)
  28. 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Advanced Use Cases Use Off-Cloud Custom Payload Deep Linking Custom Apps via API Filter Expressions
  29. 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Interested in building custom apps? DEV402: Deep-Dive for AWS X-Ray Thursday (11/30) @ 1:00 p.m. Venetian, Level 2, Titian 2204
  30. 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How Does AWS X-Ray Work?
  31. 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. X-Ray SDK Enables you to get started quickly without having to manually instrument your application code to log metadata about requests Source on GitHub under https://www.github.com/aws/ Available for Java, .NET, Python, Go, and Node.js Adds filters to automatically capture 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)
  32. 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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 Pre-installed on AWS Lambda Can be run anywhere as long as AWS credentials are provided (for example, EC2, ECS, on-premises, developer machine, and others)
  33. 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. X-Ray Service
  34. 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  35. 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  36. 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  37. 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  38. 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  39. 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  40. 40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  41. 41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  42. 42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace ID & Propagation
  43. 43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. App & X-Ray SDK EC2 Instance X-Ray Daemon Localhost UDP X-Ray API HTTPS HTTPS X-Ray Console App & X-Ray SDK Server X-Ray Daemon Localhost UDP EC2 Role AWS Credentials DevOps Team HTTPS X-Ray Workflow
  44. 44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Sampling Configuration { "rules": { “payment": { "id": 1, "service_name": "*", "http_method": "*", "url_path": "/api/payment/*", "fixed_target": 0, "rate": 1.00 }, "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 100% sampling rate with no minimum number of requests to trace to requests with paths under /api/payment The second overrides the default sampling rule with a rule that traces the first request each second and 10% of additional requests
  45. 45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. APIs
  46. 46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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 (that is, 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
  47. 47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. X-Ray API PutTraceSegments Uploads segment documents to AWS X-Ray BatchGetTraces Retrieves a list of traces specified by ID GetServiceGraph Retrieves a document that describes services in your application and their connections GetTraceSummaries Retrieves IDs and metadata for traces available for a specified time frame using an optional filter
  48. 48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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 }
  49. 49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Getting Started
  50. 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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
  51. 51. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Agent Installation (Amazon EC2 Windows)
  52. 52. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Agent Installation (Amazon ECS)
  53. 53. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. App 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());
  54. 54. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Customer Story
  55. 55. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Introduction Alain Nicolet Enterprise Architect for Operator and Restaurant facing systems Atlanta, Georgia Chick-fil-A
  56. 56. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cloud + DevOps + Microservices Journey
  57. 57. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Spring Boot Operator Mobile App • Sales Metrics API • Labor API • Truck Tracking API • User Preferences API • News API • And More Use Case AWS Lambda AWS Elastic Beanstalk Amazon DynamoDB
  58. 58. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Successful, Not Perfect!  Made a big impact  Positive feedback from operators!  Microservices are awesome! X Debugging is log-based, annoying, and slow Need application-level tracing and performance monitoring
  59. 59. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Enter X-Ray • Evaluated APM options including X-Ray • It had the features we needed • Participated in beta • Used it for the past year AWS X-Ray
  60. 60. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Trace Everything? Yes Cloud Pricing AWS X-Ray Standard: Always have application-level performance monitoring turned on for everything we build/deploy Three reasons we chose X-Ray Before X-Ray, cost more for tracing than compute (3X to 10X) Focus on strategic initiatives, not infrastructureTracing as a Service 1) Check box at deploy 2) Add to POM 3) Common integration points 4) Custom measurements Easy Integration
  61. 61. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. X-Ray Impact Changed Our Team • 2 minutes in X-Ray saves hours • Encourages curiosity and ownership of performance • Graphical peer reviews • Data-driven decisions Enables Analytics • URL-level performance metrics • Export data and track changes over time • Track against error budgets
  62. 62. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Real-World Use Case
  63. 63. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  64. 64. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  65. 65. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  66. 66. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  67. 67. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  68. 68. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thanks! “Don’t dismiss the importance of making fun a priority.” - Truett Cathy Contact information: Alain Nicolet www.linkedin.com/in/alainnicolet Atlanta, GA Chick-fil-A
  69. 69. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Additional Information
  70. 70. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. X-Ray Pricing Free tier  The first 100,000 traces recorded are free  The first 1,000,000 traces retrieved or scanned are free Additional charges  Beyond the free tier, traces recorded cost $5.00 per million traces  Beyond the free tier, traces retrieved or scanned cost $0.50 per million traces
  71. 71. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Helpful Links Go to https://aws.amazon.com/xray to learn more Documentation: http://docs.aws.amazon.com/xray/latest/devguide/aws- xray.html Samples:  .NET: https://github.com/awslabs/aws-xray-dotnet-webapp  Java: https://github.com/awslabs/eb-java-scorekeep/tree/xray  Node.js: https://github.com/awslabs/eb-node-express-sample/tree/xray  Python: https://github.com/awslabs/eb-py-flask-signup/tree/xray  Lambda: https://github.com/awslabs/aws-xray-rekognition-lambda-sample  Alarms & Alerts: https://github.com/aws-samples/aws-xray-cloudwatch-event
  72. 72. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Q&A
  73. 73. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you!

×