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

Lightning Node Performance

Lightning Node Performance

Josh Ghent

August 07, 2018
Tweet

More Decks by Josh Ghent

Other Decks in Technology

Transcript

  1. Lightning O D E A P P P E R

    F O R M A N C N E
  2. Bundle size Server latency Client broadband speed Disk I/O Database

    Availability Node Engine Parse Times Network I/O Server hardware speed Client device thermal throttling Cold starts Third-party code Why is it loading slow? Well...
  3. < 200ms - feels instant < 1s - performing smooth

    < 5s - kinda slow Stats: Speed Matters Vol.3 < 8s - user has lost attention Response Times
  4. You don't truly know someone until you have seen them

    with a slow internet connection - Sigmund Freud* *probably
  5. PERFORMANCE PRINCIPLES LESS IS MORE OPTIMIZE FOR PRODUCTION ONLY SHIP

    WHAT IS USED NODE_ENV="production" Abstract common libraries out 'depcheck' module to remove unused modules Respect data plans Use 'bundlesize' to set limits Code split Javascript ✂ Reduce cold starts for Lamdas ❄ Be network resilient Utilize Webpack Treeshaking Remove unused imports Minify Pool DB Connections , Use inbuilt language features Application caching ⚡
  6. Sunburst chart showing CPU activity. Left shows the express app

    running with NODE_ENV omitted. Right, is when NODE_ENV was set to "production"
  7. Removing unused code will reduce memory usage, cut down load

    times, and alleviate intensive CPU parsing
  8. Rate limit image Oh no, it's the Rate Limit Police!

    Ello, ello, what's all this then? Looks like it's the 100th request this second! RATE LIMIT
  9. How? Why? Customers stop using an app if it is

    slow Measure, Budget, Optimize, Measure How? What?