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

LDNWebPerf April 2017 - Andy Still

LDNWebPerf April 2017 - Andy Still

Serverless is the latest buzzword sweeping the industry but what is it and more importantly, how does it perform?

Transcript

  1. Digital Performance Serverless Performance By Andy Still

  2. Andy Still : Technical Director & Founder, Intechnica Web: www.intechnica.co.uk

    Email: andy.still@intechnica.co.uk Twitter: @andy_still / @intechnica Blog: http://www.internetperformanceexpert.com/ http://www.intechnica.co.uk/web-performance-warrior.aspx http://oreil.ly/2cJLxZh http://oreil.ly/2ce2ghE
  3. Digital Performance What is Serverless?

  4. History

  5. History

  6. History

  7. History

  8. History – Going Virtual

  9. History – into the cloud

  10. History – into the cloud

  11. Now : Serverless

  12. Digital Performance What is AWS Lambda?

  13. Digital Performance What it isn’t

  14. A lamb

  15. None
  16. A lamborghini

  17. A C# Lambda Expression customers.Where(c => c.City == "London");

  18. Digital Performance So, what is it then?

  19. Digital Performance A standalone piece of code that runs in

    a shared infrastructure
  20. Important Lesson…

  21. It is not Serverless…

  22. It does still run on servers…

  23. You just don’t need to know about them

  24. Better name: Function-As-A-Service

  25. A standalone piece of code that runs in a shared

    infrastructure Code is managed and deployed as individual functions Triggered by external events
  26. A standalone piece of code that runs in a shared

    infrastructure You are only responsible for your code – the environment is outside your control No control over compute resources used You specify the amount of memory you want assigned to your function
  27. Multiple Supported Languages Can develop in 4 supported languages Java

    Python Node C#
  28. Digital Performance Benefits

  29. Benefits No servers to manage Code scales to your requirements

    Can execute many times in parallel Only pay for execution time Tracked down to nearest 100ms Isolation of functionality
  30. Digital Performance How does it work?

  31. None
  32. Digital Performance How can it be triggered?

  33. Triggers Other AWS services S3 Dynamo DB Kinesis SNS Cloudwatch

    External requests Via AWS API Gateway E.g. triggered from website Scheduled Proactive or reactive
  34. Digital Performance What’s it for?

  35. Real time file processing

  36. Real time Data Processing

  37. Data Transformation

  38. Deployment tasks  Plumbing for a deployment pipeline  Platform

    transforms  Backups  etc
  39. Backends

  40. Digital Performance Performance – is it ready for prime time?

  41. Serverless does not mean no servers… Just you don’t have

    to worry about servers
  42. Whilst you can simplify the management of servers and environments…

  43. The requirement to understand and analyse performance data is as

    important as ever
  44. Digital Performance Performance Challenges

  45. Standard server performance metrics are no longer available. Only stats

    available relate to external execution times
  46. All functions have to be written to be idempotent -

    no cached data or files - no connection pooling
  47. Digital Performance Overheads

  48. Understand other overheads as well as the server side request…

    Look at RUM / Synthetic data
  49. Non-server side overhead https://blog.newrelic.com/2017/01/11/aws-lambda-cold-start-optimization/

  50. Digital Performance Cold Start

  51. Functions have to create environment on first use Known as

    a Cold Start
  52. Environment has to be re- created after period of no

    activity or if underlying infrastructure needs to expand under load.
  53. After approx 5 mins of inactivity or 2-4 hours regardless

    of activity
  54. Performance of regular v Intermittent Functions https://blog.newrelic.com/2017/01/11/aws-lambda-cold-start-optimization/

  55. Each cold start Lambda execution adds significant overhead

  56. Cold start overhead varies by language

  57. Cold start overhead can be mitigated by minimising amount of

    packages included in the build
  58. Easily mitigated with scheduled task

  59. Digital Performance Serverless Performance and Economics

  60. Serverless is a perfect economic reflection of good performance

  61. Serverless is a perfect economic reflection of good performance Dan

    North
  62. Serverless Cost Model • Number of Executions • Memory allocated

    • Execution Time 3 Elements
  63. Execution is charged in 100ms blocks – optimise performance to

    meet these block limits
  64. As always… evaluate cost savings against cost of optimisation

  65. Digital Performance Optimising Memory size

  66. Memory is the only dial available – adjusting memory also

    adjusts the CPU and other server settings
  67. Example: Low memory, High CPU task Task: In local testing,

    uses <50mb of memory https://serverless.zone/my-accidental-3-5x-speed-increase-of-aws-lambda-functions-6d95351197f3#.q18h6eg9k
  68. Example: Low memory, High CPU task REPORT Duration: 2120.67 ms

    Billed Duration: 2200 ms Memory Size: 128 MB REPORT Duration: 2778.51 ms Billed Duration: 2800 ms Memory Size: 128 MB REPORT Duration: 2185.11 ms Billed Duration: 2200 ms Memory Size: 128 MB REPORT Duration: 1883.18 ms Billed Duration: 1900 ms Memory Size: 128 MB REPORT Duration: 353.52 ms Billed Duration: 400 ms Memory Size: 1536 MB REPORT Duration: 340.44 ms Billed Duration: 400 ms Memory Size: 1536 MB REPORT Duration: 356.91 ms Billed Duration: 400 ms Memory Size: 1536 MB REPORT Duration: 280.49 ms Billed Duration: 300 ms Memory Size: 1536 MB REPORT Duration: 336.75 ms Billed Duration: 400 ms Memory Size: 1536 MB Before: After: Increasing memory improved performance 7x
  69. Digital Performance Consistency of Performance

  70. Lambda functions deliver inconsistent performance https://blog.symphonia.io/the-occasional-chaos-of-aws-lambda-runtime-performance-880773620a7e#.s1vd0mr6f

  71. Regular executions at varying memory size infrastructure

  72. Sorted into response time order

  73. What does this mean? Documented performance levels are WORST CASE

    SCENARIO
  74. What does this mean? Performance scales *at least* proportionally to

    memory settings
  75. What does this mean? Higher memory settings result in higher

    levels of consistency
  76. What does this mean? Benchmarking requires long term data capture

    to be sure of reliable interpretation
  77. Digital Performance Platform Comparison

  78. Response Time Under Load Azure Functions Google Cloud AWS Lambda

    http://cloudacademy.com/blog/microsoft-azure-functions-vs-google-cloud-functions-fight-for-serverless-cloud-domination-continues/
  79. Digital Performance Questions

  80. Andy Still : Technical Director & Founder, Intechnica Web: www.intechnica.co.uk

    Email: andy.still@intechnica.co.uk Twitter: @andy_still / @intechnica Blog: http://www.internetperformanceexpert.com/ http://www.intechnica.co.uk/web-performance-warrior.aspx http://oreil.ly/2cJLxZh http://oreil.ly/2ce2ghE