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

Performance Tales of Serverless

Performance Tales of Serverless

Function-as-a-Service serverless cloud offerings provide us with an easy way to run custom code in response to events. One promise of FaaS model is the ability to scale without limits, up or down, whenever needed.

But how does that work in practice? Can Azure Functions handle thousands of messages per second? How fast can it scale up under sudden heavy load? What kind of latency can you expect, and what factors does it depend on?

This session is a set of short tales, each one of them teaching us a lesson about practical scalability of serverless applications. I will also suggest steps to evaluate whether your application profile is suitable for serverless today.

Mikhail Shilkov

October 13, 2018
Tweet

More Decks by Mikhail Shilkov

Other Decks in Programming

Transcript

  1. 2

  2. 13

  3. 15

  4. AWS Processing Speed per Reserved RAM 52 0 1 2

    3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  5. # OF REQUESTS / SEC RESPONSE TIME (MS) TIME (MINUTES)

    Azure Functions Response Percentiles (ms) 57
  6. # OF REQUESTS / SEC RESPONSE TIME (MS) TIME (MINUTES)

    AWS Lambda Response Percentiles (ms) 59
  7. Google Cloud Functions: Persist Connections const http = require('http'); const

    agent = new http.Agent({keepAlive: true}); exports.mycloudfunction = (req, res) => { req = http.get({ host: '...', port: 80, path: '...', agent: agent }, // ... 61
  8. # OF REQUESTS / SEC RESPONSE TIME (MS) TIME (MINUTES)

    Google Functions Response Percentiles (ms) 62
  9. Cold Starts: Language Comparison 75 V1 .NET V1 Javascript V2

    .NET V2 Javascript COLD START TIME (SEC)
  10. Cold Starts: Language Comparison 76 V1 .NET V1 Javascript V2

    .NET V2 Javascript V2 Java (Preview) COLD START TIME (SEC)
  11. Cold Starts: Dependencies Add Up 77 Hello World 5 MB

    Zipped 35 MB Zipped COLD START TIME (SEC)
  12. Fighting Cold Starts 78 [FunctionName("Warmer")] public static void WarmUp( [TimerTrigger("0

    */15 * * * *")] TimerInfo timer) { // No need to do anything }
  13. Don’t Do This 80 [FunctionName("MyFunc")] public static async Task Run([QueueTrigger("q")]

    string message) { using (var client = new HttpClient()) { var response = await client.GetAsync("https://mikhail.io"); // ... the rest goes here } }
  14. Reuse Connections 81 private static HttpClient Client = new HttpClient();

    [FunctionName("MyFunc")] public static async Task Run([QueueTrigger(“q")] string message) { var response = await Client.GetAsync("https://mikhail.io"); // ... the rest goes here }
  15. HTTP Endpoint – Bcrypt Hashes 84 # OF REQUESTS /

    SEC RESPONSE TIME (S) TIME (MINUTES)
  16. HTTP Endpoint – Scaling Out 85 # OF REQUESTS /

    SEC INSTANCE COUNT TIME (MINUTES)
  17. 88