Slide 1

Slide 1 text

RELIABILITY ENGINEERING FOR ENTERPRISE SERVERLESS MASASHI TERUI @ JAWS DAYS 2018

Slide 2

Slide 2 text

SERVERWORKS CO.,LTD. + FREELANCER • Serverless Oji-san • Serverless Framework Plugin Developer • Serverlessconf Tokyo 2016/2017 speaker • Remote worker (in Sapporo) • The best Cloud Engineer in Hokkaido!! (Ͱ͋Γ͍ͨʣ MASASHI TERUI ARCHITECT / DEVELOPER

Slide 3

Slide 3 text

AGENDA SERVERLESS ͬͯͳΜ͚ͩͬʁ 1 6 2 7 3 8 4 9 5 10 SERVERLESS ͷ৴པੑͱ͸ʁ SERVERLESS ͷΑ͋͘Δ՝୊ SERVERLESS Λ࣮ମΛଊ͑Δ RELIABILITY ߟ͑ํ RELIABILITY ઃܭฤ RELIABILITY ࣮૷ฤ RELIABILITY ؂ࢹฤ SUMMARY ੈքΛ޿͛Δ SERVERLESS ͸ಛผ͡Όͳ͍

Slide 4

Slide 4 text

SERVERLESSͬͯͳΜ͚ͩͬʁ WHAT IS

Slide 5

Slide 5 text

CNCF SERVERLESS WHITEPAPER V1.0 • Serverless computing refers to the concept of building and running applications that do not require server management • A platform may provide one or both of the following: • Functions-as-a-Service (FaaS) • Backend-as-a-Service (BaaS) • Products or platforms deliver the following benefits to developers: • Zero Server Ops • No Compute Cost When Idle 
 https://github.com/cncf/wg-serverless/tree/master/whitepaper

Slide 6

Slide 6 text

SERVERLESS IS NOT GLUE IN ENTERPRISE APPLICATION ”THE ORCHESTRATOR MANAGES THE TRADES USING A GRAPH OF STATES”

Slide 7

Slide 7 text

SERVERLESS CLOUD NATIVE LANDSCAPE

Slide 8

Slide 8 text

BUT I PREFER THIS ONE https://www.slideshare.net/acloudguru/ant-stanley-being-serverless

Slide 9

Slide 9 text

SERVERLESS USE CASES (FROM CNCF WP) • Asynchronous, concurrent, easy to parallelize into independent units of work • Infrequent or has sporadic demand, with large, unpredictable variance in scaling requirements • Stateless, ephemeral, without a major need for instantaneous cold start time • Highly dynamic in terms of changing business requirements that drive a need for accelerated developer velocity • Non-HTTP-centric and non-elastic scale workloads that weren’t good fits for an IaaS, PaaS, or CaaS solution (Event Driven workloads)

Slide 10

Slide 10 text

“There are many workloads that are stateful and/or not easy to parallelize” ͱࢥͬͯ·ͤΜ͔ʁ “Asynchronous and Event Driven processing is too difficult for humans”

Slide 11

Slide 11 text

SERVERLESSͷ৴པੑͱ͸ʁ Reliability

Slide 12

Slide 12 text

RELIABILITY(RASIS) ࡉ෼Խ͢Δͱ৭ʑ͋Δ • Reliability • Availability • Serviceability • Integrity • Security ͜͜Ͱ͸ҎԼͷΑ͏ʹఆٛ
 ʮReliability = ޿ٛͷ৴པੑ(RASIS)ʯ Reliability Availability Serviceability Integrity Security Reliability

Slide 13

Slide 13 text

IS SERVERLESS DIFFICULT TO GUARANTEE THE RELIABILITY? • Strongly depends on FaaS platform and BaaS products • Lose the business continuity (Reliability, Availability) • Distributed Instances • Lose the traceability (Serviceability) • Hard to develop • All become functions (Serviceability) • NoSQL matches better than RDB (Integrity)

Slide 14

Slide 14 text

SERVERLESSͷΑ͋͘Δ՝୊ i s s u e s

Slide 15

Slide 15 text

FaaSͷΑ͋͘Δ՝୊ • How to test the functions? • Granularity of the functions • Messaging between the functions and backends • Handling request and response (Error Handling) • Log Aggregation, Traceability • Monitoring

Slide 16

Slide 16 text

BaaSͷΑ͋͘Δ՝୊ • How to choose the services? • Fault Tolerance • Monitoring

Slide 17

Slide 17 text

SERVERLESSͷ࣮ମΛଊ͑Δ Mechanism HINT

Slide 18

Slide 18 text

MECANISM OF FAAS

Slide 19

Slide 19 text

SERVERLESS PROCESSING MODEL https://github.com/cncf/wg-serverless/tree/master/whitepaper#detail-view-serverless-processing-model ॲཧͷશମ૾Λ௫Ή Πϕϯτιʔε͔ΒͷΠϕϯτॲཧཁٻΛ ଟ਺ͷΠϯελϯε্ͷFunction͕෼ࢄॲཧ

Slide 20

Slide 20 text

THE INTERNAL FLOW OF PROCESSING https://github.com/apache/incubator-openwhisk/blob/master/docs/about.md#the-internal-flow-of-processing Πϕϯτ(HTTP)͕ॲཧ͞ΕΔྲྀΕΛ௫Ή ετϦʔϜ΍ΩϡʔΛڬΜͰ෼ࢄॲཧ͢Δͷ͕جຊ ֎͔ΒݟͯಉظͰ΋த͸ඇಉظ͔ͭ෼ࢄ

Slide 21

Slide 21 text

THE FUNCTIONS THAT INVOKED ASYNCHRONOUS IN THE CONTAINERS FaaS is… ίϯςφ಺Ͱඇಉظʹݺͼग़͞ΕΔؔ਺

Slide 22

Slide 22 text

WHAT IS BAAS?

Slide 23

Slide 23 text

FROM OWNERSHIP TO USE SERVICES Ϋϥ΢υʹΑͬͯαʔό͕ॴ༗͔Βར༻΁ ͞Βʹϛυϧ΢ΣΞ΍ϥΠϒϥϦ΋ར༻΁ BaaSΛ࢖͏ͷ͸ͦ͏͍͏ࣗવͳྲྀΕ

Slide 24

Slide 24 text

FULLY MANAGED AND ABSTRACTED MIDDLEWARES AND LIBRARIES BaaS is… ϑϧϚωʔδυ͔ͭந৅Խ͞ΕͨMW΍ϥΠϒϥϦ

Slide 25

Slide 25 text

SERVERLESS͸ಛผ͡Όͳ͍ is not special

Slide 26

Slide 26 text

CONSTITUTED OF THE ABSTRACTED FUNCTIONS AND MIDDLEWARES Serverless is… ந৅Խ͞ΕͯΔ͚ͩͰؔ਺ͱMWͰͰ͖ͯΔ

Slide 27

Slide 27 text

WE CAN MAKE RELIABLE SERVERLESS APPLICATION SO… ৴པੑ͸࡞ΕΔʂ

Slide 28

Slide 28 text

RELIABILITYͷߟ͑ํ Method of thinking

Slide 29

Slide 29 text

RELIABILITYͷߟ͑ํ • Make the reliability by myself • Serverless will help you, but will not protect your business • Think simple • Apply generally development/operation practices • If you can't apply the practices, take care of the serverless mechanism • Keep simple • Don't be afraid that increase the number of the functions • We should be afraid complicated architecture • Change your mind as a software • Everything is part of your application

Slide 30

Slide 30 text

RELIABILITY ઃܭ Architecting

Slide 31

Slide 31 text

ALL EVENTS FLOWS IN THE SAME DIRECTION Πϕϯτ(σʔλ)͸ಉ͡ํ޲ʹྲྀ͢ ݁Ռ͕ඞཁͳΒಉظͰฦͣ͞ औΓʹߦ͔ͤΔ

Slide 32

Slide 32 text

ALL EVENTS FLOWS IN THE SAME DIRECTION • They will be naturally Asynchronous and Functional • Asynchronous processing is Retriable • Functional processing is Reproducible • The clients get the results by myself • However, polling is not good choise... • Pushing is better choice • Can we be happy with AppSync? (Pushing via Websocket)

Slide 33

Slide 33 text

UNIFY THE ENDPOINTS BETWEEN THE SERVICES αʔϏεؒͷΤϯυϙΠϯτ͸ू໿͢Δ ϥοϓͯ͠ू໿͠ίϯτϩʔϧΛಘΔ

Slide 34

Slide 34 text

UNIFY THE ENDPOINTS BETWEEN THE SERVICES • Microservices • Separate the services by the domains (One BaaS is one of your service) • The endpoint of the service is not unique, it has the endpoints for each operations • Wrap the endpoints to abstract them • Like a “MySQL Server” and “libmysql” • Do you call “libmysql” directly? • You can make Failover/Failsafe mechanism • Like a Reverse Proxy • Do you connect to multiple “Read replicas” from “each app servers”? • Trafic controlling, Caching

Slide 35

Slide 35 text

ALL SERIES OF EVENTS HAVE THE SAME ID Ұ࿈ͷॲཧʹ͸ಉ͡IDΛ෇༩ ͦΕΛҾ͖ճ͢͜ͱͰIDͰτϨʔεͰ͖Δ ͜ͷID͸༷ʑͳ੍ޚʹ΋࢖͑Δ

Slide 36

Slide 36 text

ALL SERIES OF EVENTS HAVE THE SAME ID • Log Aggregation • A series of events can be traced by the ID • Monitor the progress • Log all event messages • Execution control • At least once -> Exactly once • e.g. DynamoDB Conditional Writes • Make it easy to implement with something like a decorator

Slide 37

Slide 37 text

DATA MODELING • Become the friend with DynamoDB • Distributed by Partition Key and Indexed(B-tree) by Sort Key, LSI • GSI is a projection of sorted(indexed) data • The consistency can be guaranteed without ACID transaction • Denormalization • Strong consistency reading, 
 Conditional Writing • There are some difficult situation • Write asynchronous to RDB

Slide 38

Slide 38 text

RELIABILITY ࣮૷ Implementation

Slide 39

Slide 39 text

GRANULARITY OF THE FUNCTIONS •Testable!! • Unit testing is justice in the serverless world • Make the dependencies of other services are replaceable • Would be replaceable to the mocks • Easy to Failover/Failsafe

Slide 40

Slide 40 text

HOW TO TEST THE FUNCTIONS • Unit testing is justice in the serverless world (2ճ໨) • Deploy a new environment if the mocks are not enough at integration testing • It is easy with some frameworks (e.g. Serverless, SAM) • The services outside of AWS are needed to be easily to deploy (via API) • Continuous E2E testing with traceable ID • It become a monitoring

Slide 41

Slide 41 text

RELIABILITY ؂ࢹ Monitoring

Slide 42

Slide 42 text

RELIABILITY MONITORING • The greatest monitoring is the notifications from the application • Be sure to catch the errors and notify them • Collect the metrics of the services • CloudWatch • This is a condition to choice the services outside of AWS • Continuous E2E testing with traceable ID

Slide 43

Slide 43 text

SUMMARY

Slide 44

Slide 44 text

“SERVERLESS IS NOT SPECIAL” THANKS!! “MAKE THE RELIABILITY BY MYSELF” “THINK SIMPLE, KEEP SIMPLE” “EVERYTHING IS PART OF YOUR APPLICATION” “LET'S EXPAND SERVERLESS WORLD”

Slide 45

Slide 45 text

bit.ly/jd2018-sls #jawsdays #jd2018_a PLEASE TAKE A SURVEY