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

Server-Side goes Serverless

Server-Side goes Serverless

Slides from my talk at Google I/O 2017 Extended Fortaleza where we try to understand why the serverless architecture's been drawing so much attention from developers lately by seeing how this model can help significantly reduce the operational costs and complexity of our applications.

97d21da8e0ffa8f81218a293482c253a?s=128

Matheus

May 19, 2017
Tweet

Transcript

  1. server-side goes serverless @ythecombinator @feliborgez

  2. !!!

  3. #1 it has nothing to do with serveless but…

  4. #1

  5. #2 + architecture - code

  6. #3 pretty much focused on experiences

  7. stalkr

  8. None
  9. Travis CI 

  10. GitHub 

  11. Apex 

  12. Heroku 

  13. None
  14. http://getstal.kr

  15. / Matheus Albuquerque full-stack developer draft illustration enthusiast open source

    lover web alchemist Felipe Borges back-ender minecraft lover mobile developer google enthusiast
  16. / Matheus Albuquerque full-stack developer draft illustration enthusiast open source

    lover web alchemist Felipe Borges back-ender minecraft lover mobile developer google enthusiast
  17. / Matheus Albuquerque full-stack developer draft illustration enthusiast open source

    lover web alchemist Felipe Borges back-ender minecraft lover mobile developer google enthusiast
  18. / Matheus Albuquerque full-stack developer draft illustration enthusiast open source

    lover web alchemist Felipe Borges back-ender minecraft lover mobile developer google enthusiast
  19. / Matheus Albuquerque full-stack developer draft illustration enthusiast open source

    lover web alchemist Felipe Borges back-ender minecraft lover mobile developer google enthusiast #after 
  20. who ???

  21. back-end development

  22. back-end development devops

  23. back-end development devops IaaS

  24. back-end development devops IaaS PaaS

  25. back-end development devops IaaS PaaS BaaS

  26. back-end development devops IaaS PaaS BaaS FaaS

  27. history

  28. None
  29. back in 2012…

  30. None
  31. None
  32. None
  33. problems we have

  34. × development costs × scaling costs × operational management

  35. so what ???

  36. micro service nano service serverless Function as a Service Backend

    as a Service
  37. #1 serverless

  38. ✓ logic is executed in an environment without visible processes,

    OS, servers or virtual machines ✓ the responsibility for provisioning and managing the infrastructure belongs entirely to the service provider ✓ significantly depend on third-party services ✓ functionality needed was offered as services, covering databases, messaging, authentication, etc ✓ software developer focuses on writing code
  39. #2 Backend as a Service

  40. ✓ started as MBaaS ✓ provide server-side logic ✓ manage

    their internal states ✓ applications that do not have application- specific, server-side logic ✓ use third-party services for everything
  41. ✓ Authentication as a Service (Auth0, AWS Cognito, Firebase) ✓

    Logging as a Service (Loggly, Logsense, Amazon Elasticsearch Service) ✓ Analytics as a Service (Amazon Kinesis, Keen IO).
  42. #3 Functions as a Service

  43. ✓ short-living stateless functions ✓ triggered by events ✓ provider

    does the rest: ✓ provisioning instances of such functions, ✓ terminating instances, ✓ monitoring all of them, ✓ identity and logging services, ✓ …
  44. Auth0 Webtask AWS Lambda Google Cloud Functions Azure Functions IronFunctions

    IBM OpenWhisk
  45. #4 Micro & Nano services

  46. ✓ a suite of small services ✓ each running in

    its own process ✓ each communicating with lightweight mechanisms ✓ these services are built around business capabilities ✓ independently deployable
  47. microservice !→ all CRUD operations on an account nanoservice !→

    each account operation: create, read, update, and delete
  48. back to problems

  49. #1 development costs

  50. e.g. authentication

  51. code your own authentication functionality

  52. ✓ removes much of the database administration overhead ✓ provides

    mechanisms of authorization for different types of users
  53. #2 scaling costs

  54. 1 request / minute 50 ms / request 0.1% mean

    CPU usage / hour
  55. 100ms compute / minute 0.15% of the overall time

  56. ✓ democratize things ✓ breaking down components by logic /

    domain even without working with the operational costs (startups )
  57. e.g. inconsistent traffic

  58. https://martinfowler.com/articles/serverless.html

  59. 200 https://martinfowler.com/articles/serverless.html

  60. autoscaling

  61. less than 4% of total uptime total hardware capability x

    10
  62. try: code optimization

  63. #3 operational management

  64. on the BaaS side

  65. less components maybe… = less work *

  66. on the FaaS side

  67. × compressing your code × puppet / chef × start

    / stop shell scripts × decisions about whether to deploy one or many containers on a machine
  68. when to use?

  69. #1 slack bots

  70. #2 database wrappers

  71. #3 scientific computing

  72. http://ericjonas.com/pywren.html

  73. different ways

  74. #1 command pattern

  75. http://freecontent.manning.com/patterns-for-solving-problems-in-serverless-architectures/

  76. #2 messaging pattern

  77. http://freecontent.manning.com/patterns-for-solving-problems-in-serverless-architectures/

  78. #3 priority queue pattern

  79. http://freecontent.manning.com/patterns-for-solving-problems-in-serverless-architectures/

  80. #4 fan-out pattern

  81. http://freecontent.manning.com/patterns-for-solving-problems-in-serverless-architectures/

  82. #5 pipes & filters pattern

  83. http://freecontent.manning.com/patterns-for-solving-problems-in-serverless-architectures/

  84. drawbacks

  85. × not efficient for long-running applications × vendor lock-in ×

    introduce additional overhead for function/microservice calls × multitenancy × cold start × different methods for logging in functions
  86. up & running

  87. None
  88. $ npm install -g firebase-tools $ firebase init $ firebase

    deploy $ firebase login $ firebase init functions const functions = require('firebase-functions'); …
  89. in the end…

  90. ✓ reduced time ✓ lower operational and development costs ✓

    works well with agile development ✓ allows developers to focus on code and to deliver faster ✓ fits with microservices ✓ reduces the complexity ✓ simplifies packaging and deployment
  91. !!!

  92. None
  93. questions?

  94. thanks! @ythecombinator @feliborgez