Company
Date Published
Author
Type
Word count
1086
Language
English
Hacker News points
None

Summary

As data usage and traffic are expected to increase tenfold, a Node.js web app faced potential performance bottlenecks due to SQL query loads, prompting a need for optimization to handle the anticipated surge. Call site attribution was implemented to address this issue, allowing developers to trace SQL queries back to their source code for efficient identification and resolution of performance bottlenecks. Initial solutions using Datadog and monkey patching were deemed too costly or ineffective, leading to the adoption of a call site tagging system, which tags SQL queries with user-defined strings indicating their origin. This approach enhanced query traceability and system legibility without incurring additional costs, although it faced implementation challenges with the TypeORM library, which only partially supported query tagging. By wrapping TypeORM calls and using a query builder for tagging, nearly all queries were covered, allowing developers to identify and optimize problematic areas in the codebase effectively. This strategic implementation of call site tagging has positioned the app to manage its expected growth, ensuring ongoing optimization as user traffic continues to scale.