Blazing Fast Node.js: 10 Performance Tips for LinkedIn Mobile
Article Summary
LinkedIn Engineering discovered that one synchronous file write operation tanked their Node.js throughput from thousands of requests per second to just dozens.
Back in 2011, LinkedIn's mobile team documented 10 performance principles that transformed their Node.js servers across iPhone, Android, and HTML5 platforms. These lessons from Shravya Garlapati remain surprisingly relevant for modern mobile backends.
Key Takeaways
- Disable socket pooling or increase maxSockets to prevent high-concurrency bottlenecks
- Return JSON instead of server-rendered HTML for maximally efficient data transfer
- Execute blocking operations in parallel using flow control libraries like Step
- Go session-free to eliminate memory overhead and external storage round trips
- Use binary modules over JavaScript implementations for performance-critical code
Node.js performance hinges on staying truly asynchronous and keeping your server focused on dynamic data, not static assets or rendering.
About This Article
LinkedIn's mobile servers wasted resources by having Node.js handle static assets like CSS and images at the same time as dynamic content. This wasn't an efficient use of Node.js, which is better suited for other workloads.
Shravya Garlapati's team moved static content delivery to nginx and CDNs instead. This let Node.js focus on processing dynamic data and reduced the overall load on their servers.
Removing static asset serving from Node.js meant faster content delivery through geographically distributed CDN servers. Node.js could then handle more concurrent mobile requests without getting bogged down.