raleigh devday 2017: distributed serverless stack tracing and monitoring

49

Upload: amazon-web-services

Post on 22-Jan-2018

94 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring
Page 2: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

WIFI: awsDevDay | PASS: CodeHappy

U P N E X T :

Distributed Serverless Stack

Tracing and Monitoring

Page 3: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

T H A N K S T O O U R F R I E N D S A T :

Page 4: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Andrew Baird, AWS

08/01/2017

Distributed Serverless Stack

Tracing and Monitoring

Page 5: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

About Me

Who: Andrew Baird / [email protected]

What: Enterprise Solutions Architect – Atlanta, GA

Previous:

Software Development Engineer – Amazon.com Listing Platform

Page 6: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

What to expect from the session

• Concepts

• Overview

• Use cases

• Demo

• API

• Getting started

Page 7: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

AWS Lambda Concepts

Page 8: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Serverless means…

No servers to provision

or manage

Scales with usage

Never pay for idle Availability and fault

tolerance built in

Page 9: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Never pay for Idle

EVENT DRIVEN CONTINUOUS SCALING PAY BY USAGE

Page 10: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Common Serverless Use Cases

Web

Applications

• Static websites

• Complex web

apps

• Packages for

Flask and

Express

Data

Processing

• Real time

• MapReduce

• Batch

Chatbots

• Powering

chatbot logic

Backends

• Apps &

services

• Mobile

• IoT

</></>

Amazon

Alexa

• Powering

voice-enabled

apps

• Alexa Skills

Kit

Autonomous

IT

• Policy engines

• Extending

AWS services

• Infrastructure

management

Page 11: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Monolithic

Monolithic vs. Service Oriented Architecture

Service Oriented Architecture

Page 12: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Drawbacks of Monolithic Architecture

Hard to Iterate Fast CI/CD Time ConsumingHard to scale Efficiently

Reliability Challenges

Page 13: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Benefits of Service Oriented Architecture

Increased Agility Easy to Scale Improved Innovation

Reduced Human Errors

Page 14: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

AWS X-Ray Concepts

Page 15: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

X-Ray Key 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

Page 16: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

How X-Ray works

Page 17: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Debugging applications

Page 18: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Traditional Debugging

Developer Local Test

DeveloperAdd

Breakpoints

Add Log

Statements

Page 19: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

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.

Page 20: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Debugging applications with X-Ray

Page 21: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Identify Performance

Bottlenecks

How does AWS X-Ray help?

Pinpoint Specific

Service Issues

Identify Errors Identify Impact to

Users

Page 22: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Use cases

Page 23: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Visualize service call graph

Page 24: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Identify impact

Page 25: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Identify performance bottlenecks

Page 26: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Identify performance bottlenecks

Page 27: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Identify performance bottlenecks

Page 28: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Pinpoint issues

Page 29: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Pinpoint issues

Page 30: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Pinpoint issues

Page 31: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

How does AWS X-Ray work?

Page 32: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

X-Ray SDK

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)

Enables you to get started quickly without having to manually

instrument your application code to log metadata about requests

Page 33: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

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.)

Page 34: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

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.

Page 35: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

AWS X-Ray API

Page 36: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

X-Ray API

Raw trace data is available using batch get APIs.

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. (e.g. you can write your own SDKs for languages/frameworks not currently supported)

You can build your own data analysis applications on top of the data

collected by X-Ray.

Page 37: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

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

Page 38: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

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

}

Page 39: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Getting started

Page 40: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Agent installation (Amazon 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

Page 41: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Agent Installation (Windows)

Page 42: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Agent installation (Amazon ECS)

Page 43: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Application instrumentation (Node.js)

Example pseudo code:

Page 44: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Demo

Page 45: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Pricing

Page 46: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

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

Page 47: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Available Today!

The AWS X-Ray service is available today.

Go to https://aws.amazon.com/xray to get started.

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

Page 48: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Thank You!

Page 49: Raleigh DevDay 2017: Distributed serverless stack tracing and monitoring

Don’t Forget Evaluations!