the journey to serverless at home24 - reflections and insights

51
1 The Journey to Serverless Çağatay Gürtürk, Martin Lindenberg Software Engineering, Home24 AG

Upload: aws-germany

Post on 11-Apr-2017

150 views

Category:

Technology


0 download

TRANSCRIPT

1

The Journey to ServerlessÇağatay Gürtürk, Martin Lindenberg Software Engineering, Home24 AG

2

Agenda

• About Home24

• Our Journey to AWS and Serverless Architectures

• Use cases of Serverless Applications

• Caveats and Solutions

• Question and Answer Session

3

About home24

Europe's largest online only retailer for home furniture and living

Active in 7 countries, 5 different languages

100+ IT Employees

4

Desktop website

4.2 million visitors per month23 millions page views per month

5

• The Best Shopping Application in 2015 in Germany

• Selected as Featured app many times by App Store

Available in IOS and Android

80000+ Monthly Active Users

Mobile applications

6

There is always an invisible part of the

Iceberg.

7

Endless stuff to deal with by 100+ people and 10+ teams

Order Processing

Business Intelligence Tools

Supporting Services for Customer Facing

Apps

Financial Tools

8

Home24 was launched with a modified

Magento software

MAGENTO

Monolithic PHP application on on-

premise infrastructure

OWN SOFTWARE

MICROSERVICE AND CLOUD

20152011 2013

Our technical journey

Switched to Microservice

architecture. Deprecated PHP: Every new project

in GO, JAVA and JS

Migrated to AWS

9

Why Microservices?

• Teams can choose the right tool for every service

• Every team can hold the ownership of a service

• Every team can manage its own infrastructure

Thus,

• Increases autonomy for teams

• Distributes the infrastructural risks

10

AWS Migration

Not only a provider change, but a mindset change

11

Why AWS?

• Cost efficient

• Scalable

• Requires less operation effort

12

What is serverless?

• Every service managed by AWS

• Pay as you go. No need for 24/7 running infrastructure

• Less operation effort

• Focus on Dev of business requirements instead of Ops

13

On-Premise Serverless

Not only Lambda but…

And more services…

14

Case Studies

15

Serverless Case Studies

• Parcel Service (Simple) – Our first attempt. Basic REST API

• Margin DB (Medium) – Responding to cloud events with zero custom infrastructure

• Voucher Manager (Expert) – Fully serverless application using Cognito and Lambda

16

Parcel Service

17

Parcel Service

Stores delivery and packaging informationfor each product

Planned as new microservice to break themonolith

Less than 10000 requests per day

Response time of less than 100ms isrequired

18

Previous stack for new microservices

19

Serverless stack

API Gateway

20

Deployment options

Serverless framework

Cloudformation

Manually (Using CLI scripts or AWSConsole)

21

Serverless stack

22

The Limitations

Number of supported languages arelimited. (We like GO more then Node!)

Container startup affects response times ofsome requests

SNI-Support required

API Gateway = public visible endpoint

23

The Wins

Pay only for usage(+ 1 million requests free per month)

API‘s can be secured with api keys

More memory = More CPU = Lower latency

Response times down to 30ms are possible

24

Price comparison

25

Margin DB

26

Margin DB

How much profit do we make per product?

More than 100.000 products with multiplevarieties

Daily recalculation

27

Margin DB: event based workers

28

Cost

Service Usage Cost ($)

S3 170 GB-Mo 5.01

Lambda 39 million sec. 690

SNS 110 Millions Req. 45

SQS 232 Millions Req. 116

SWF 38000 0.79

EC2 0 Hours 0!

Note: usage and cost information are approximate.

Previous EC2 cost was 800$ but it was difficult to scale

29

Voucher Manager

30

Lets users store their vouchers in their mobile devices and use them in their purchases with 1-click

Lets us send new vouchers or remove old ones over the air

Voucher Manager

Project started with AWS

31

Voucher Manager

32

Voucher Manager

33

Cognito & Lambda

Stores user data in cloud with zero-backend

code

Support custom authentication as well as

social logins

Lambda hooks for more functionality

+

34

Case 1: Users add a voucher on mobile device

35

Case 1: Users add a voucher on mobile device

Nerdy LLDB output

Objective-C Code - Not for home use

Insanely easy implementation on mobile applicationOnly use AWS Cognito SDK

36

Case 1: Users add a voucher on mobile device

37

Case 2: Voucher data changes on Backend

We have an auxiliary DynamoDB tableto keep this relationship

38

Case 3: Add Voucher from other channels

39

Cost

Service Usage Cost ($)

API Gateway 2.1 million req. 7.57

Lambda 385000 seconds 6.19

Cognito Sync 344.410 Sync operations 5.17

Amazon EC2 0 Hours 0!

Note: usage and cost information are approximate. Negligible costs of SNS and DynamoDB are not included.

40

How we build?

41

Tooling

• Native JAVA• Homemade deployment tools built by Gradle and Cloudformation

• Node.js• Serverless framework (Formerly JAWS)

42

Problems and Solutions

Encountered problems, fixed and addressed ones

43

AWS Lambda Problems and Solutions

Problem: Less control over server optimizations

Solution: It is natural. Still you can increase RAM and CPU usage

44

AWS Lambda Problems and Solutions

Problem: Lack of standard deployment tools

Solution: AWS is not providing any automatic deployment tool but there are open source solutions or it is easy to develop your own

45

AWS Lambda Problems and Solutions

Problem: Long cold start times. (Especially on JVM.)

Solution: Keep it warm. Invoke the function periodically using Route53 Health Check or Cloudwatch scheduled event

46

API Gateway Problems and Solutions

Problem: Slower than classical EC2-ELB stack

Solution: According to our experience, for many applications API Gateway’s performance is satisfying. But if you are developing a really low-latency service, API Gateway might not be the right solution at the moment

47

API Gateway Problems and Solutions

Problem: ACM support, GZIP compression and HTTP caching are missing

Solution: Put a Cloudfront distribution in front of API Gateway. With Cloudfront you can enable all these features

48

DynamoDB Problems and Solutions

Problem: Auto-scaling is missing

Solution: Use Dynamic DynamoDB or implement a custom Lambda autoscalingmechanism.

Fingers crossed for Autoscaling support from AWS

Dynamic DynamoDB available at: https://github.com/sebdah/dynamic-dynamodb

49

Future

Running the whole platform without EC2 Instances

50

Selection criteria for Serverless

• Performance requirements

• Language/Framework requirements

• Scalability and High Availability Requirements

• Budget Constraints

51

QUESTIONS & ANSWERS SESSION