Query Details

Find Processes With Unusually High Thread Or Handle Counts

Query

// Use Case: Identifying processes with unusually high thread or handle counts for performance analysis and optimization.
Process
| where ThreadCount > 100 or HandleCount > 1000
| project ProcessName, ProcessId, ThreadCount, HandleCount, Path
| order by ThreadCount desc, HandleCount desc

Explanation

This query is designed to help identify processes on a system that might be using an unusually high number of threads or handles, which can be useful for performance analysis and optimization. Here's a simple breakdown of what the query does:

  1. Data Source: It starts by looking at data from a table or dataset named Process, which contains information about running processes.

  2. Filter Criteria: It filters the processes to find those that have more than 100 threads or more than 1000 handles. These thresholds are set to identify processes that might be consuming more resources than usual.

  3. Select Information: For each of these processes, it selects (or "projects") specific pieces of information: the name of the process (ProcessName), its ID (ProcessId), the number of threads it is using (ThreadCount), the number of handles it is using (HandleCount), and the file path where the process is located (Path).

  4. Order Results: Finally, it orders the results by the number of threads in descending order, and if there are ties, by the number of handles also in descending order. This means the processes with the highest thread counts will appear first in the results.

Overall, this query helps in quickly identifying and examining processes that might be impacting system performance due to high resource usage.

Details

Ugur Koc profile picture

Ugur Koc

Released: December 13, 2024

Tables

Process

Keywords

Process

Operators

whereorprojectorder bydesc

Actions