Achieving Serverless Harmony With Traditional Apps Story Time - - PowerPoint PPT Presentation

achieving serverless harmony
SMART_READER_LITE
LIVE PREVIEW

Achieving Serverless Harmony With Traditional Apps Story Time - - PowerPoint PPT Presentation

Achieving Serverless Harmony With Traditional Apps Story Time Began with EC2 instances in ASGs, Ansible automation Introduced Serverless Framework Replace small HTTP service with API Gateway Move async jobs into Lambda Kill


slide-1
SLIDE 1

Achieving Serverless Harmony

With Traditional Apps

slide-2
SLIDE 2

Story Time

  • Began with EC2 instances in ASG’s, Ansible automation
  • Introduced Serverless Framework
  • Replace small HTTP service with API Gateway
  • Move async jobs into Lambda
  • Kill async/cron workers

harmonize.serverless.zone

slide-3
SLIDE 3

Expensive Tasks

  • 1. Breaking up shared-memory coupling
  • 2. Connecting legacy apps to new event streams
  • 3. Rewriting jobs to Lambda-supported languages

harmonize.serverless.zone

slide-4
SLIDE 4

Incidental Glue

FaaS in other Services Using Cognito triggers, Config Rules, and infra cron jobs.

Backend Tasks

Intentional Event Stream Architecture and plans change to match new tools/processes and intentionally start migrating features.

User-Facing

Major Replacement Critical-path features move from your monolith to separate serverless deployments.

harmonize.serverless.zone

slide-5
SLIDE 5

Cheap Tasks

  • 1. Solving embarrassingly parallel problems
  • 2. Training the rest of the team
  • 3. Shrinking server fleet

harmonize.serverless.zone

slide-6
SLIDE 6

Starting Points

On-Prem

Bare Metal

IaaS

Virtual Machines

Cloud Native

Highly Automated VMs/ Containers

harmonize.serverless.zone

slide-7
SLIDE 7

Hard Parts

slide-8
SLIDE 8

Scaling

Downstream Service Considerations

  • Introduce back pressure
  • Prioritize user-facing tasks
  • Denormalize data into

messages

harmonize.serverless.zone

slide-9
SLIDE 9

Queueueueueueueing

  • Kinesis retries handle capacity problems
  • Serial, but only if you fit on one shard
  • Put the full information the event needs in its trigger

○ S3 notably can’t ○ SNS partially does this with invoke event size limit

  • Dead Letter Queue

harmonize.serverless.zone

slide-10
SLIDE 10

DynamoDB

  • Makes a great scratch space because events include

○ HASH+RANGE ○ New and old versions of modified data ○ TTL to expire finished job records while leaving an audit trail

  • RCU/WCU remaining provides back pressure
  • Autoscaling (with limits)

○ Even adjustable … from a Lambda

harmonize.serverless.zone

slide-11
SLIDE 11

Codebases

  • Monorepo vs. split service
  • Deployment pipelines

harmonize.serverless.zone

slide-12
SLIDE 12

Monorepo

  • Keeps attribution
  • Single history
  • Always test full repo
  • Cross-cutting changes are easier
  • No dependent pull requests
  • Smaller individual repos
  • Per-repo test pipelines
  • Fewer changes in-flight
  • Cross-repo changes
  • Submodules (ew)

harmonize.serverless.zone

slide-13
SLIDE 13

Deploy Pipelines

  • Deploys have to be independent
  • Avoid backwards incompatible changes in event formats
  • DB migrations now have one more step

harmonize.serverless.zone

slide-14
SLIDE 14

Monitoring

Revealing Brewing Problems

  • Log log log log
  • Cloudwatch connections
  • Combine legacy and new

sources

  • Teach new techniques

harmonize.serverless.zone

slide-15
SLIDE 15

Structured Logging

  • Logs are events, not strings
  • Machine-readability matters
  • CloudWatch filters can parse logged values to metrics
  • JSON avoids regex pain and sadness

harmonize.serverless.zone

slide-16
SLIDE 16

Structured Log

{ “timestamp”: 1493214552, “event”: “user.login.success”, “user”: “ryansb”, “method”: “totp-2fa”, “source”: { “type”: “web.navbar”, “client”: “git-b263b0” } }

slide-17
SLIDE 17

Central Visibility

  • Forward everything to...

○ CloudWatch? ○ IOPipe (Lambda Only) ○ Honeycomb ○ ELK Stack

harmonize.serverless.zone

slide-18
SLIDE 18

harmonize.serverless.zone @ryan_sb

Thanks!