Thread-Safe Function Usage Tracking via In-Memory Hash Table
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional techniques for tracking function usage in enterprise systems incur performance overhead, interfering with the system's performance and making it difficult to target heavily used or critical functions for customization, testing, or upgrades.
Innovation Solution
Implementing an in-memory hash table for thread-safe tracking of function calls, where each thread updates the hash table with function calls and a collector thread periodically updates a data store with usage data, minimizing locks and ensuring efficient tracking without significant performance issues.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If conventional logging techniques are used to track function usage, then function usage can be tracked, but performance overhead increases and interferes with system performance
Solution Approach 1:
The patent extracts the tracking overhead from the main execution path by using a separate hash table data structure that threads can update without blocking. The collector thread periodically extracts usage data from the hash table and writes it to a data store, separating the measurement function from the performance-critical function execution path.
Solution Approach 2:
The patent introduces an intermediary hash table data structure that sits between the function calls and the final storage. Threads update the hash table with function usage information without direct I/O operations, and the collector thread acts as an intermediary that periodically transfers this data to the data store, reducing the performance impact on the main system.
2Loss of information
If logging is implemented to track function usage, then usage data can be collected, but it creates performance overhead and makes it difficult to identify heavily used functions
Solution Approach 1:
The patent performs preliminary action by maintaining a hash table that continuously accumulates function usage data in memory during system operation. This pre-computed data is ready for immediate retrieval by the collector thread, eliminating the need to analyze raw logs after the fact and enabling rapid identification of heavily used functions.
Solution Approach 2:
The patent replaces the mechanical system of writing detailed logs to disk with an in-memory hash table data structure that allows for O(1) insertion and efficient aggregation. This substitution of storage mechanism dramatically reduces the time required to collect and analyze usage data, enabling near-real-time identification of heavily used functions.
3Reliability
If thread-safe tracking is implemented with locks, then data consistency is maintained, but latency increases
Solution Approach 1:
The patent segments the tracking system into two distinct components: a write path that threads use to update the hash table with function usage data, and a read path that the collector thread uses to transfer data to the data store. This segmentation allows concurrent access without locks on the write path, maintaining reliability while minimizing latency through lock-free operations for the majority of threads.
Solution Approach 2:
The hash table data structure is designed to be self-service in terms of thread safety, using intrinsic properties of the data structure (such as hash bucket segmentation or lock-free algorithms) to ensure data consistency without requiring external locking mechanisms. This allows threads to safely update usage data without acquiring locks, eliminating the latency associated with lock acquisition and release.
Data Source
AI summary
Techniques for tracking function usage in an enterprise system are provided. The techniques include executing a set of processes in one or more applications on one or more computer systems. Next, a set of threads in each process is used to track, in a hash table stored in memory on a computer system, calls to a set of functions by the process. A thread in the process is then used to update a data store containing usage data for the process with the tracked calls in the hash table.


