serverless design patterns for rethinking traditional enterprise application approaches | aws public...

22
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Robert Groat , Smartronix @groatr Bin Lu , Fannie Mae June 14 th , 2017 Serverless Design Patterns “Rethinking" Traditional Enterprise Application Approaches

Upload: amazon-web-services

Post on 21-Jan-2018

1.180 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

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

Robert Groat , Smartronix @groatr

Bin Lu , Fannie Mae

June 14th, 2017

Serverless Design Patterns

“Rethinking" Traditional Enterprise Application Approaches

Page 2: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Agenda

- What is Serverless?

- What is AWS Lambda?

- How is it used?

- Why do I care?

- Look what Fannie Mae did!

- Total enlightenment

Page 3: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

About Smartronix

• Premier Partner for all 5 years

• Inaugural Managed Services Partner

• Inaugural Migration Delivery Partner

• Inaugural Big Data Competency

• Inaugural DevOps Competency Partner

• 1st to bring Federal government in to AWS

• 1st to implement FISMA Moderate/ FedRAMP

solutions (NIST 800-53 Rev. 4)

• One of the largest channel resellers

• Successfully completed FedRAMP 3PAO

Assessment for Managed Services

• Named Leader in Gartner MQ for Public Cloud MSP,

Worldwide – March 2017

Page 4: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

AWS Compute Services Overview

Service

Unit

Layer

EC2

Virtual

Machine

Hardware

ECS

App

OS

LAMBDA

Function

Runtime

Page 5: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Lambda Overview

Quite simply:

Run code based on events without managing servers

Page 6: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Serverless?

- Serverless : adjective - “1. I don’t have to manage a virtual

machine, operating system, patch management, scaling

service, load balancing, availability, fault tolerance,

provisioning, antivirus, anti-malware, vulnerability scanning,

continuous monitoring, access control, rightsizing, server

tuning, intrusion detection, hardware affinity, OS

dependencies, …ad nauseum”

AND

- I only pay for what I use!

Page 7: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Too good to be true…

- OK, with some limitations:

- Limited function/code size (250 MB code package)

- Asynchronous and stateless *

- 500 MB temp directory

- 300 second runtime

- 128MB to 1.5 GB Memory limitations

- 3000 concurrent function executions *

* Note: Many of these limitations are easily addressable!

Page 8: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

“Traditional” Use Cases

- Dynamic event handling

- Scheduled event processing

- File Processing / Data Transformation

- Mobile backend services

- Streaming event sourcing / handling

- Secure REST endpoints

Page 9: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

“Re-think”– Transformative Use Cases

- Autonomic Security Remediation

- Serverless Websites

- Dynamic log analysis

- IoT response handling

- Massively Parallel Processing???!!?

Page 10: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Old School Problem Solving

- Problem Statement:

- I need to run quadrillions of cash flow simulations on tens of millions of

loans every month under various economic models to determine risk.

- Old School Approach:

- Build a massive compute and shared storage infrastructure that at

capacity meets the PEAK business requirement

- License an expensive GRID control platform to orchestrate the job

scheduling and data pipelines

- Old School Result:

- Very expensive server and storage infrastructure with high management

burden and inconvenient utilization

Page 11: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

…Slightly Less Old School Problem Solving

- Circa 2016 “Catch All” Approach

- “MOVE IT TO THE CLOUD,” says every IT talking head

- “LIFT AND SHIFT,” says every new cloud engineer

- License an expensive GRID control platform to orchestrate the job

scheduling and data pipelines

- Circa 2016 Result

- Somewhat less expensive server and storage infrastructure with high

management burden and slightly more convenient utilization patterns.

Better but not great.

Or… You can Re-Think your approach and do what Fannie Mae did!

Page 12: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

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

Bin Lu, Fannie MaeJune 14th, 2017

High Performance Computing Using

AWS Lambda for Financial Modeling

Page 13: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Fannie Mae Business

Fannie Mae is a leading source of

financing for mortgage lenders:

• Providing access to affordable mortgage

financing in all market conditions.

• Effectively managing and reducing risk

to our business, taxpayers, and the

housing finance system.

In 2016, Fannie Mae provided $637B in

liquidity to the mortgage market, enabling

• 1.1M home purchase ,

• 1.4 M refinancing,

• 724K rental housing units.

Page 14: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Fannie Mae Financial Modeling

Financial Modeling is a Monte-Carlo simulation process to project future cash flows

which is used for managing the mortgage risk on a daily basis:

• Underwriting and valuation

• Risk management

• Financial reporting

• Loss mitigation and loan removal

~10 Quadrillion (10𝑥1015) cash flow

projections each month in hundreds

of economic scenarios.

Page 15: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Fannie Mae Financial Modeling Infrastructure

High Performance Computing grids are the key infrastructure components for

financial modeling at Fannie Mae.

Current Environment Issues

- No longer meets growing business needs

- 7 years old with limited non-elastic compute, storage, and IO capacity

- Costly server and storage refresh

- Complex API

- It takes more than half a year to add incremental compute capacity and

develop any new application.

Page 16: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Ideal New Solution Requirements

New secure capability that helps us react to the rapidly

changing market- Near infinite compute and unlimited storage with high availability

- Simple distributed computing API

- Efficient cost model

- Maximizes re-use of existing code base

- Short time to deploy solution

- Reduce operational burden – reliable and easy to manage

- Enable use of innovative services “adjacent” to our data

Page 17: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Fannie Mae’s Journey

In 2016, Fannie Mae began to work with AWS and Smartronix to build the first

serverless HPC computing platform in the industry using AWS Lambda. This is also

the first pilot program for Fannie Mae to develop an AWS cloud native application.

Minimal code refactoring was required and within a month we were able to run a

successful proof of concept.

By March 2017, Fannie Mae successfully deployed the first financial modeling

application to preproduction and ran on 15,000 concurrent executions

By June 2017, production migration of first workload!

Page 18: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Serverless HPC Reference Architecture

Map-reduce framework is used for simple parallel workload:

• Input file in S3 input bucket is split using EC2 to n triggers, which are saved in S3 event bucket.

• Lambda automatically ramps up n concurrent executions and outputs to S3 mapper bucket.

• EC2 is used to aggregate outputs and write final result to S3 reducer bucket.

Amazon S3

Input

Amazon

EC2

Splitter

AWS Lambda

Mappers

Amazon

EC2

Reducer

AmazonS3

Mapper

Result

Amazon

Reducer

Result…

Amazon S3

Event

Page 19: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Results!

Lambda service configuration:

• Initial burst rate = 3,000, incremental rate > 240

per minute, throttle limit = 15,000.

• Lambda ramps up automatically from 3,000 to

15,000 concurrent executions.

Application result:

• One simulation run of ~ 20 million mortgages takes

1.5 hours, >4 times faster than the existing process.

• Performance doesn’t degrade during ramp up period.

• Lambdas’ CPU efficiency is close to 100%. Actual elapsed time is consistent with

the estimated elapsed time based on Lambda billing time.

Number of New

Lambda Invocations

Every 5 Minutes

Maximum Concurrent

Lambdas = 15,000

Page 20: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

HPC Grid – On Premises

Idle or constrained capacity

High CapEx costs

High maintenance burden

Performance constrained

Long time to add capacity

License fees

Long time to deliver new service

Single environment availability

Service Comparison

Serverless HPC with Lambda

Scales to meet demand

Pay per use (actual vCPU usage)

Fully managed service

Horizontal scale

Near infinite capacity on-demand

No added license fees

Rapid CI/CD – low complexity

High business resiliency

Page 21: Serverless Design Patterns for Rethinking Traditional Enterprise Application Approaches | AWS Public Sector Summit 2017

Summary

• Cloud Native thinking has potential for enormous value

• Traditional approaches can hamper your cloud adoption

• Don’t be afraid to refactor

• Establish architectural patterns with distributed systems

thinking from the start

• Serverless = Enterprise grade

• STOP DOING UNDIFFERENTIATED HEAVY LIFTING!

Focus your efforts on your code not your infrastructure.