N T I A L Memory scheme (v8): • Resident Set • Code Segment • Stack • Heap • Used heap R E S ID E N T SE T CO DE S E GM E NT STACK H E AP RSS H E APTOTA L H E AP US E D E XT E R N AL
N T I A L Relation between GC and a memory leak? • Impossible to remove non referenced data. • Portion of memory allocated not released when no longer needed.
N T I A L Things you can do on Runtime performance issues: • --perf-basic-prof-only-functions. • A system tool like Perf Events in Linux. • Spare the traces that are really important in your situation.
N T I A L 27 Process to investigate an issue: • Think and construct an hypothesis • Collect data • Analyze the data (duh) • Draw a conclusion • Repeat (profit?)
N T I A L 28 Strategy for Memory Leaks detection: • Inspect objects for more context. • Look for weird objects on heap • Growing object counts are likely leaking • Walk reverse references to find the root object • Compare object counts !important
N T I A L What is happening? • On the first snapshot, there are already/almost 7-8MB allocated before any request is processed. • Memory keeps growing while the server is running • Date and Objects have been allocated between the two load sessions.
N T I A L • As you can see, the memory growth is far slower! • This said, the API takes more time to respond. Reading and writing to the disk comes with a cost, so do other API calls or database requests.
N T I A L 36 Goals • Discover how the system performs under sustained usage • Ensure that after a long period, the system response time will remain the same or better than the start of the test. • Manage the future loads, we need to understand how many additional resources are necessary to support usage in future
N T I A L k6 is your friend • Can output more granular metrics than what is printed on stdout • Testing tool for testing the performance of your backend infrastructure • Written in Go and JavaScript
N T I A L 38 N|Solid to the rescue! • Monitoring and diagnostic tools to help identify and tackle tricky issues. • Production friendly. • Shows performance insights. • Helps you build highly reliable applications and minimize infrastructure costs.
N T I A L Blocking the Event Loop • Totally possible • Happens more times we want it to happen (who wants to block it in first place?) • Iterations and complex calculations would prevent the process from handling other events
N T I A L Succeed doing I/O operations: • Choose asynchronous over synchronous • Opt for parallel I/O wherever possible • Don't hog the JavaScript thread with long-running calculations and iterations