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

JSBelgrade #29: Intro to Effortless Serverless

JSBelgrade #29: Intro to Effortless Serverless

Getting acquainted with serverless, current development and deployment problems and how does serverless solve them

Aleksandar Simovic

October 10, 2017
Tweet

More Decks by Aleksandar Simovic

Other Decks in Programming

Transcript

  1. Random startup company • Education • Innovative • Investments (millions

    $$$) • High level experts, publications, patents • Switched to new stacks a few times already, each “better” than the previous one • 100,000s users
  2. Organization Customers (Angular) API Admin (Angular) Company site (Wordpress) Elastic

    Search “State of the art” Other services Owners (Angular)
  3. Infrastructure VPS (server rental) • Heroku • EC2 • Azure

    Environments (per server) • Development • Staging • Production
  4. Scaling, balancing? • Capacity planning 
 At best random guesses.

    100,000 users. 
 Estimations - at most 20,000 are going to login at the same time, horrible mistakes • Environments setup
 dedicated DevOps guys = dedicated cursing machines • Deployment
 ssh, scp everything • Scaling, Balancing
 the hell
  5. Problems • Taking 15 mins to 1 hour to deploy

    a “bug” to all production servers • One service eating up the server memory, other dying and not logging • Most of the time just waiting for a request • Recovery time (2-7h) • Configuring a new server took 2h • Pressure / Yelling • Angry phone calls / messages at 4 am - 
 “Are you awake? The production crashed.”
  6. Washing machines What the hell they have in similar with

    the current development and deployment issues? Quite a lot.
  7. Washing machine • Processing machine - cleans clothes • Receives

    various types of clothes • Has a maximum amount • Can mix different types of clothes • You can buy various types from a big one to handle more, to small ones
  8. Problems • Takes from 15 minutes to 2h to wash

    all your laundry • One cloth color can spoil the other - your special princess dress • Waiting, until it receives clothes • Can get stuck or broken (then you have to call the plumber)
 Recovery time: > 1 day • Buying a new washing machine and setting it up >2h • You can buy a big one to handle more, but then its dumb to turn it on just for one shirt f.e. - so you usually wait • Your partner yelling at you for breaking it 
 (definitely not from a personal experience)
  9. • Taking 15 mins to 1 hour to deploy a

    “bug” to all production servers • One service eating up the server memory, other dying and not logging • Most of the time just waiting for a request • Recovery time (2-7h) • Configuring a new server took > 1h • Hexa-core for an Angular app? Seriously? • Pressure / Yelling • Angry phone calls / messages at 4 am 
 (“Are you awake? The production crashed.) • Takes from 15 minutes to 2h to wash all your laundry • One cloth color can spoil the other - your special princess dress • Waiting, until it receives clothes • Can get stuck or broken (then you have to call the plumber)
 Recovery time: > 1 day • Buying a new washing machine and setting it up > 1h • You can buy a big one to handle more, but then its dumb to turn it on just for one shirt f.e. - so you usually wait • Your partner yelling at you for breaking it 
 (definitely not from a personal experience) Server issues Washing machine issues Can’t be the same…
  10. The rise of the laundry
 ”The evolution of the laundry

    industry” First “Washateria” 1934. Mass laundromats 1950s First “Fluff and Fold” services 1970s Mass “FnF” and the decline of laundromats 2000s
  11. So serverless is? • The new “Fluff and Fold”? •

    The new “cloud”? • Silver bullet? • Holy grail? • Cure for cancer?
  12. Serverless is a method of deploying and running applications on

    cloud infrastructure, on a pay-per-use basis and without renting or buying servers. Serverless But how does not having servers help?
  13. Serverless does not exclude the existence of servers. It just

    abstracts away the need to physically rent or buy a server, including setting up its OS, environment, installing services, and so on. Serverless
  14. How does that work? Containers 
 Isolated environment that contains

    everything your application needs to run - as plant pots.
  15. Average API server usage Utilization Intervals 35% 60% 80% 06

    09 12 15 18 70% 45% 21 00 03 06 0% 100% Looks good enough? Price: 100$
  16. Average API server wasted time Intervals 65% 40% 20% 99%

    30% 55% 95% 99% 0% 100% Bad enough? Waste 06 09 12 15 18 21 00 03 06
  17. API server utilization + an unexpected peak Utilization Intervals 35%

    60% 110% 70% 45% 0% 100% So having new customers Is a problem ?! “Unexpected” peak = new required capacity 06 09 12 15 18 21 00 03 06
  18. The “new” API server usage Utilization Intervals 28% 54% 80%

    63% 38% 0% 100% We are “safe” now! Buffer New Price: 150$ - (if you’re lucky) 06 09 12 15 18 21 00 03 06
  19. The serverless way • Pay per request • No request

    - no charge • No request - no active server • “Hosting” your app is free
  20. Providers (most notable) • Amazon - AWS Lambda • Microsoft

    - Azure Functions • Google - Google Cloud Functions • IBM - BlueWhisk
  21. Refactoring • Makes sense as it has a financial incentive

    • Better code, less cost • No more statements: “Well, its working good enough already”