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

Introduction to Serverless

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

Introduction to Serverless

A quick introduction to the serverless architecture.

Avatar for Pubudu Kodikara

Pubudu Kodikara

October 26, 2017

More Decks by Pubudu Kodikara

Other Decks in Technology

Transcript

  1. What is serverless architecture? - There are servers!!! Don’t worry!

    - But we do not need to worry about them. The serverless providers will manage the back end for us. - The term serverless means, you don’t have to worry about servers anymore. Focus on your code. Someone else will focus on maintaining servers and scaling your app. - Event based execution. Your code will execute only if a pre-defined event triggers it. An API call, a scheduler call or a provider specific event. - Pay only for what you use. You only pay for the execution time and the resources your function used at that time. - BaaS and FaaS: BaaS, applications which fully depend on cloud services like Firebase. FaaS, we write some server side logic.
  2. Function as a service (FaaS) - Think about micro services.

    - Break the application into small independent functions.
  3. How does it work? (Example: AWS Lambda) - Function and

    its configuration will be stored in a storage server like S3. (It’s not executed. Just stored). - When a function is invoked, the provider will launch a container (A lightweight piece of software which includes everything that needs to run the code like system tools, compilers, system libraries, settings, etc). - Your code will be executed. - The provider will keep the container up for a small time incase it receives another call. - If no invocation happens for a certain period of time, the container will be stopped.
  4. Advantages of serverless - Reduced cost: No need to pay

    for a server 24/7. No need to pay for server maintenance. - Auto scaling: Scaling is just an addition for your bill. - Reduced overhead === Reduced time to market
  5. - Vendor lock: You are tied to your vendor. Hard

    to switch services. - Cold boot: Time it takes to run a fresh container. - Debugging is tricky. - You need to start to think differently. Disadvantages of serverless
  6. When not to use serverless? - When your application need

    instant feedback and real time data. - When you have a long running task. - The technology is still new...
  7. Some tips and tricks to save your day... - While

    building an app, if you use something like serverless offline to locally run the functions, don’t forget to deploy periodically and test it. - If you use webpack, note that it does take extra ram. - If you want to share variables between multiple invocations, put that code outside the handler. - They bundle your node_modules folder! Keep an eye on your libraries.