Skeelo Nicolas Frasson Jun 11, 2024

How We Optimized Concurrency Using Node.js at Skeelo

Article Summary

Skeelo's engineering team achieved a 30% performance boost by rethinking one simple thing: when NOT to use await in Node.js.

The team discovered they were blocking their main thread unnecessarily by awaiting operations that didn't need immediate responses. By strategically using callbacks and letting Node's Event Loop handle non-critical tasks, they dramatically improved their app's responsiveness.

Key Takeaways

Critical Insight

Not every async operation needs await: identifying which tasks can run in the background cut response times by 30%.

The article includes a real login function refactor that shows exactly which operations to await and which to let run free.

About This Article

Problem

Skeelo's login function took 500ms total because the team was awaiting all operations in sequence. This included publishing to a notification queue, which didn't actually need to finish before responding to the user.

Solution

Nicolas Frasson's team removed the await from the queue publishing step. They added .catch() for error handling instead, letting Node.js handle the task in the background without blocking anything.

Impact

Login now completes in 350ms. The notification queue processes asynchronously in the background, so user authentication responses aren't delayed.