This repository contains the code examples I used in the Node.js Performance Optimization Talk. The examples demonstrate common performance issues in Node.js applications and how to solve them progressively.
The example is a simple product catalog API that showcases three main performance issues:
- Blocking Event Loop: CPU-intensive calculations and synchronous operations blocking the main thread
- Promise Chain: Sequential execution of independent async operations that could be processed simultaneously
- Missing Cache: Repeated expensive operations that could benefit from caching
main
branch contains the initial example with all three performance issuesasync
branch shows the first optimization step - making operations asynchronousunchained
branch demonstrates simultaneous processing of independent operationscached
branch shows the final optimized version with caching
git clone https://github.com/vpukhanov/node-profiling-talk
cd node-profiling-talk
npm install
npm start
Then in another terminal:
# Test the unoptimized version
npm run load-test