Note: I'm answering my own question here for posterity as I'm sure others will want to find the answer. I haven't seen anyone provide good solution to this question.
Question: How does one calculate actual search concurrency usage and overlay with maximum search concurrency.
Answer to follow.
The Answer.
The calculation for max concurrent searches is
(max_searches_per_cpu * cpu_count + base_max_searches) * num_search_members
where ...
The calculation for actual concurrent searches
Data is in the _audit index
The logic consists of
Example Timechart
Search
index=_audit action=search host=<search_heads> NOT "search_id='rsa_scheduler"
| fields - _raw
| eval search_type=case(match(search_id,"scheduler_"),"Scheduled",match(search_id,"SummaryDirector"),"Summarize")
| eval search_type=if(isnull(search_type),"Ad-Hoc",search_type)
| eval end_time=exec_time + total_run_time
| eval events=exec_time + " " + search_type + " 1:" + end_time + " " + search_type +" -1"
| fields _time events
| makemv delim=":" events
| mvexpand events
| rex field=events "(?<_time>\S+)\s+(?<type>\S+)\s+(?<incr>\S+)"
| fields - events
| sort 0 _time
| streamstats current=f sum(incr) as concur by type
| timechart span=30s first(concur) by type
| eval "max search concurrency" = [
| rest /services/properties/limits/search/max_searches_per_cpu
| fields splunk_server value
| rename value as max_searches_per_cpu
| append [
| rest /services/properties/limits/search/base_max_searches
| fields splunk_server value
| rename value as base_max_searches
]
| append [
| rest splunk_server=<search_heads> /services/server/status/resource-usage/hostwide
| eval cpu_count = if(isnull(cpu_count), "0", cpu_count)
| fields splunk_server cpu_count
]
| stats values(max_searches_per_cpu) as max_searches_per_cpu values(base_max_searches) as base_max_searches values(cpu_count) as cpu_count by splunk_server
| eval instance_max_concurrent_searches = (max_searches_per_cpu * cpu_count + base_max_searches)
| stats sum(instance_max_concurrent_searches) as max
| return $max
]
Please Upvote if you fine helpful
The Answer.
The calculation for max concurrent searches is
(max_searches_per_cpu * cpu_count + base_max_searches) * num_search_members
where ...
The calculation for actual concurrent searches
Data is in the _audit index
The logic consists of
Example Timechart
Search
index=_audit action=search host=<search_heads> NOT "search_id='rsa_scheduler"
| fields - _raw
| eval search_type=case(match(search_id,"scheduler_"),"Scheduled",match(search_id,"SummaryDirector"),"Summarize")
| eval search_type=if(isnull(search_type),"Ad-Hoc",search_type)
| eval end_time=exec_time + total_run_time
| eval events=exec_time + " " + search_type + " 1:" + end_time + " " + search_type +" -1"
| fields _time events
| makemv delim=":" events
| mvexpand events
| rex field=events "(?<_time>\S+)\s+(?<type>\S+)\s+(?<incr>\S+)"
| fields - events
| sort 0 _time
| streamstats current=f sum(incr) as concur by type
| timechart span=30s first(concur) by type
| eval "max search concurrency" = [
| rest /services/properties/limits/search/max_searches_per_cpu
| fields splunk_server value
| rename value as max_searches_per_cpu
| append [
| rest /services/properties/limits/search/base_max_searches
| fields splunk_server value
| rename value as base_max_searches
]
| append [
| rest splunk_server=<search_heads> /services/server/status/resource-usage/hostwide
| eval cpu_count = if(isnull(cpu_count), "0", cpu_count)
| fields splunk_server cpu_count
]
| stats values(max_searches_per_cpu) as max_searches_per_cpu values(base_max_searches) as base_max_searches values(cpu_count) as cpu_count by splunk_server
| eval instance_max_concurrent_searches = (max_searches_per_cpu * cpu_count + base_max_searches)
| stats sum(instance_max_concurrent_searches) as max
| return $max
]
Please Upvote if you fine helpful