Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Serverless - Lessons Learned

395d9a1bac6f64d04bbd713d5b6bc433?s=47 Niko Köbler
September 28, 2017

Serverless - Lessons Learned

395d9a1bac6f64d04bbd713d5b6bc433?s=128

Niko Köbler

September 28, 2017
Tweet

Transcript

  1. SERVERLESS -
 BEST PRACTICES & LESSONS LEARNED NIKO KÖBLER (@DASNIKO)

  2. ABOUT ME ▸ Freelance Consultant/Architect/Developer/Trainer @ www.n-k.de ▸ Technical Advisor

    for Software & Support Media Group ▸ Doing stuff with & without computers, writing Software, ~ 20 yrs ▸ Co-Lead of JUG DA (https://www.jug-da.de / @JUG_DA) ▸ Speaker at international Tech Conferences ▸ Author of „Serverless Computing in AWS Cloud“
 serverlessbuch.de ▸ Twitter: @dasniko
  3. SERVERLESS COMPUTE MANIFESTO ▸Functions are the unit of deployment and

    scaling. ▸No machines, VMs or containers visible in the programming model or elsewhere. ▸Permanent storage lives elsewhere. (Functions are stateless!) ▸Scales per request: User cannot over- or under-provision capacity. ▸Never pay for idle (no cold servers/containers or their costs). ▸Implicitly fault-tolerant because functions can run anywhere. ▸BYOC - Bring Your Own Code. ▸Metrics and logging are a universal Right.
  4. SERVERLESS IS NOT FAAS ON CONTAINERS!

  5. SERVERLESS AWS BUILDING BLOCKS

  6. PAAS SERVERLESS IS AN EVOLUTION OF PAAS!

  7. None
  8. USE CASES

  9. USE CASE: SERVERLESS WEB ARCHITECTURE

  10. USE CASE: SERVERLESS STREAM PROCESSING

  11. USE CASE: SERVERLESS ANALYTICS

  12. https://medium.com/@tjholowaychuk/dos-and-don-ts-of-aws-lambda-7dfcab7ad115

  13. USE CASE: SERVERLESS MAP/REDUCE

  14. MEANWHILE OTHERS… From: http://theburningmonk.com/2017/04/aws-lambda-3-pro-tips-for-working-with-kinesis-streams/ !

  15. ENVIRONMENT NO FREEDOM OF CHOICE AT
 RUNTIME & LANGUAGE ENVIRONMENTS

    (BOUND TO WHAT PROVIDER OFFERS)
  16. PROGRAMMING MODEL CACHING CONTAINERS OBJECTS

  17. PROGRAMMING MODEL STARTING (AND HANDLING!) OF OWN PROCESSES

  18. PROGRAMMING MODEL JAVASCRIPT CALL STACK & EVENT LOOP context.callbackWaitsForEmptyEventLoop

  19. ERROR HANDLING DEAD LETTER QUEUES

  20. AWS X-RAY

  21. AWS X-RAY

  22. TIME IS YOUR ENEMY!

  23. TIMEOUT LIMITS DEFAULT TIMEOUT MAX TIMEOUT

  24. EXECUTION-TIME MEMORY SETTINGS (RAM) HAVE IMPACTS ON CPU- & NETWORK-PERFORMANCE

  25. """ FUNCTION: 1 EXECUTION / HOUR 512 MB, 10 SEC.

    MONTHLY EXECUTION COUNT: 720 MONTHLY GB-SEC.: 3.600
  26. """ FUNCTION: 1 EXECUTION / HOUR 1536 MB, 2 SEC.

    MONTHLY EXECUTION COUNT: 720 MONTHLY GB-SEC.: 2.160
  27. COLD START
 LATENCY

  28. REDUCE LATENCY (AND COSTS) CLOUDWATCH EVENTS TO PRE-WARM FUNCTIONS

  29. """ FUNCTION: 1 EXECUTION / HOUR 1024 MB, 5 SEC.

    MONTHLY EXECUTION COUNT: 720 MONTHLY GB-SEC.: 3.600
  30. """ FUNCTION: 12 EXECUTIONS / HOUR 512 MB, 100 MS.

    MONTHLY EXECUTION COUNT: 8.640 MONTHLY GB-SEC.: 432
  31. https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f

  32. https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f

  33. https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f

  34. https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f

  35. https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f

  36. https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f

  37. https://github.com/alexcasalboni/aws-lambda-power-tuning
 https://serverless.com/blog/aws-lambda-power-tuning/

  38. """ USE A SERVERLESS/LAMBDA CALCULATOR E.G. SERVERLESSCALC.COM

  39. AWS LIMITS KNOW THE LIMITS! (E.G. MAX CONCURRENT INVOCATIONS,
 PAYLOAD-SIZE,

    MEMORY-SETTINGS, ETC.) KNOW HOW TO INCREASE THE LIMITS!
  40. NETWORK & SECURITY VPC - VIRTUAL PRIVATE CLOUD Be careful!

    VPC requires Elastic Network Interfaces (ENIs). ENIs add some seconds(!!) to the cold start!
  41. API GATEWAY SECURITY AUTHENTICATION, AUTHORIZATION API-KEYS, USAGE PLANS, THROTTLING, ETC.

  42. TESTING DON’T! # LOCAL (UNIT) VS. CLOUD (INTEGRATION) AWS SAM

    Local, LocalStack
  43. BUILD & DEPLOYMENT (from: https://aws.amazon.com/codepipeline) AWS CODEPIPELINE Automated continuous integration

    and continuous delivery release workflow
  44. DEVOPS SERVERLESS IS NOT NO-OPS! NO OPS COST != NO

    COST OF OWNERSHIP! YOU ARE STILL RESPONSIBLE FOR THE (END) RESULTS KEEP DEVOPS IN MIND!
  45. MIGRATION TO SERVERLESS ‣ IDENTIFY THE PROBLEM ‣ TRAIN THE

    EXISTING TEAM ‣ CREATE A PROOF-OF-CONCEPT TO VERIFY THE PROBLEM IS SOLVED ‣ OPTIMIZE THE SOLUTION TO TAKE ADVANTAGE OF THE CLOUD ‣ AUTOMATE YOUR CONTINUOUS INTEGRATION/CONTINUOUS DEPLOYMENT PIPELINE ‣ AUTOMATE YOUR TESTING
  46. MIGRATION TO SERVERLESS 30 QUESTIONS TO ASK A SERVERLESS FANBOY

    HTTP://WWW.IHEAVY.COM/2017/03/13/30-QUESTIONS-TO-ASK-A-SERVERLESS-FANBOY/
  47. 30 QUESTIONS TO ASK A SERVERLESS FANBOY HTTP://WWW.IHEAVY.COM/2017/03/13/30-QUESTIONS-TO-ASK-A-SERVERLESS-FANBOY/ MIGRATION TO

    SERVERLESS
  48. 30 QUESTIONS TO ASK A SERVERLESS FANBOY HTTP://WWW.IHEAVY.COM/2017/03/13/30-QUESTIONS-TO-ASK-A-SERVERLESS-FANBOY/ MIGRATION TO

    SERVERLESS
  49. 30 QUESTIONS TO ASK A SERVERLESS FANBOY HTTP://WWW.IHEAVY.COM/2017/03/13/30-QUESTIONS-TO-ASK-A-SERVERLESS-FANBOY/ MIGRATION TO

    SERVERLESS
  50. 30 QUESTIONS TO ASK A SERVERLESS FANBOY HTTP://WWW.IHEAVY.COM/2017/03/13/30-QUESTIONS-TO-ASK-A-SERVERLESS-FANBOY/ MIGRATION TO

    SERVERLESS
  51. 30 QUESTIONS TO ASK A SERVERLESS FANBOY HTTP://WWW.IHEAVY.COM/2017/03/13/30-QUESTIONS-TO-ASK-A-SERVERLESS-FANBOY/ MIGRATION TO

    SERVERLESS
  52. https://d1.awsstatic.com/whitepapers/serverless-architectures-with-aws-lambda.pdf

  53. THANK YOU. ANY QUESTIONS? Slides: bit.ly/sls-ll Niko Köbler | www.n-k.de

    | niko@n-k.de | @dasniko SERVERLESS - BEST PRACTICES & LESSONS LEARNED