Seatext library / BotRefund evidence
How to Set Up Anomaly Detection for CPU Concurrency
To set up CPU concurrency anomaly detection, collect concurrency metrics, establish a normal baseline, set thresholds that trigger alerts, and pair those alerts with context to reduce false positives. This guide walks through the...
✓ Built for advertisers who need clear, refund-ready traffic evidence.
To set up anomaly detection for CPU concurrency, start by collecting concurrency metrics over time, establish a baseline of normal behavior, define thresholds that flag meaningful deviations, and configure alerts with enough context to avoid noise. This practical approach works for servers, web apps, and even bot detection. Here is the step-by-step process.
Prerequisites for CPU Concurrency Monitoring
Before you start, make sure you have these in place:
- Access to CPU concurrency metrics (e.g., thread counts, process counts, or parallel task load).
- A time-series database or logging system that stores historical metric data (e.g., Prometheus, Elasticsearch, or your cloud provider's monitoring service).
- A way to run a baseline analysis (statistical tools, a spreadsheet, or built-in anomaly detection features).
- An alerting channel (email, Slack, PagerDuty) that can receive notifications.
- Clear ownership of the monitoring setup and a plan for what to do when an alert fires.
If you are missing any of these, the setup will be harder. A readiness checklist helps you confirm you are ready:
- Can you collect concurrency values every minute (or at least every 5 minutes)?
- Do you have at least 7–14 days of historical data to build a baseline?
- Can you label normal and abnormal periods (e.g., known deployments, traffic spikes)?
- Are you prepared to tune thresholds after the first alerts?
Step-by-Step Setup Process
Step 1: Collect CPU Concurrency Metrics
You need raw data. On Linux, tools like top, vmstat, or pidstat show load averages and thread counts. In cloud environments, use built-in monitoring agents (e.g., CloudWatch, Azure Monitor, or GCP Monitoring). For application-level concurrency, instrument your code to record active threads or goroutines.
Store these metrics in a time-series database. If you already use Elasticsearch, you can use the anomaly detection features described in the AWS OpenSearch tutorial. The goal is to have a reliable stream of numeric values.
Step 2: Establish a Baseline
Anomalies are deviations from normal. Determine what “normal” looks like for your system. Look at the data from the last week or month: calculate the average, median, and common percentiles (e.g., 95th). Consider time-of-day variations—CPU concurrency often rises during business hours.
You can use a simple statistical method: define the baseline as the rolling mean and standard deviation. Or use a machine learning model that learns patterns automatically, but that requires more data and setup.
Step 3: Set Thresholds
Thresholds define when an alert should fire. Starting with a fixed threshold (e.g., “alert if concurrency > 50”) is easy but might miss slow-burning issues. Better: use a dynamic threshold based on the baseline. For example, alert when the value exceeds the 95th percentile by 2 standard deviations, or when it jumps by 3x the median.
You can also set separate thresholds for spike detection (sudden changes) and level changes (sustained deviations).
Step 4: Configure Alerts with Context
Raw metrics alone tell you something is off, not why. Include adjacent data: which process, which server, what time, and whether a deployment happened. This context helps you act quickly and reduces false alarms.
For web applications, combine concurrency metrics with other signals like response times and error rates. The CPU Concurrency Lie check from BotRefund is an example of using concurrency as part of a broader pattern: it looks for a mismatch between the reported hardware and actual processor behavior.
Step 5: Test and Tune
Run a test: simulate a spike (e.g., launch a load test) and confirm your alert fires. Then adjust thresholds based on the results. The first few weeks will produce some false positives; tweak thresholds gradually.
Choosing the Right Anomaly Detection Method
Your approach depends on your data and skills.
- Static thresholds: Simple, easy to understand, but can miss subtle shifts and produce false alarms.
- Moving average and standard deviation: Adapts to trends, but requires manual tuning.
- Machine learning models (e.g., Isolation Forest, ARIMA): Find complex patterns but need more data and expertise.
- Managed services: AWS OpenSearch, Azure Anomaly Detector, or Datadog have built-in features—fast to configure but limited to the service's rules.
If you are just starting, begin with static or moving average. Move to ML only if you see many false positives or need to detect slow drifts.
Common Mistakes to Avoid
- Setting thresholds too tight—you get alert fatigue and ignore warnings.
- Ignoring seasonality—CPU concurrency may naturally spike at business hours.
- Using only one signal—a single anomaly is not conclusive. BotRefund notes that “a single anomaly is not a bot verdict.”
- Not preserving historical data—you need a baseline, but you also need to compare current events to past incidents.
- Forgetting to document alert ownership—if no one knows who responds, the alert is pointless.
How to Verify Your Setup
After configuring alerts, verify they work. Generate a known spike (e.g., run a script that starts many threads). Confirm you receive the alert with the correct context. Then check that normal conditions do not trigger alerts.
Review the alert history weekly to see if any were false positives. If 90% of alerts are false, your thresholds are too sensitive.
Limitations of CPU Concurrency Anomaly Detection
CPU concurrency alone is rarely enough to identify a problem. Virtual machines, privacy tools, corporate networks, and unusual devices can create unexpected concurrency behavior for legitimate users. As BotRefund explains, “A single anomaly is not a bot verdict.” The same logic applies to any deployment: a spike in concurrency could be a scheduled job, a marketing campaign, or a data import—not a failure or an attack.
This method also requires enough historical data. If you have only a few days of logs, the baseline will be unreliable. And if your system changes frequently (e.g., autoscaling), thresholds that worked last month may not work today.
Key Facts About CPU Concurrency Anomaly Detection
| Fact | Detail |
|---|---|
| Core purpose | Detect unexpected changes in concurrent CPU workloads that might indicate a performance issue or automated bot activity. |
| How it works | Compare current concurrency metrics against a baseline derived from historical data. |
| Example signal | BotRefund's CPU Concurrency Lie check looks for a mismatch between a browser's reported hardware and its actual processor behavior. |
| Key limitation | A single anomaly is not a verdict; it must be cross-checked with other signals. |
| False positives | Privacy tools, travel, corporate networks, and unusual devices can produce unexpected behavior for genuine people. |
Terminology You Should Know
- Concurrency: The number of tasks a system can execute in parallel or in overlapping time slices.
- Baseline: The typical range of values for a metric under normal conditions.
- Threshold: The boundary at which a metric value triggers an alert.
- False positive: An alert that fires when no real anomaly exists.
- Cross-checking: Confirming one signal with additional independent signals before acting.
Frequently Asked Questions
Why does CPU concurrency matter for bot detection?
Automated browsers often behave differently than real users. A bot might use many threads to load pages or generate events, creating a concurrency pattern that clashes with a normal device profile. BotRefund's CPU Concurrency Lie check is one of 106 independent signals it uses to tell a human from a bot.
How long should I collect data before building a baseline?
At least one full business week to capture daily cycles. For systems with longer seasonal patterns (e.g., monthly sales peaks), collect 30 days if possible.
What if my CPU concurrency values are constantly changing due to autoscaling?
Use a dynamic baseline that recalculates automatically. You may need to normalize the metric per instance or per CPU core.
Can I set up CPU concurrency anomaly detection without a dedicated anomaly detection tool?
Yes. You can write a simple script that calculates the moving average and standard deviation from your time-series database, then sends an alert via curl. However, a managed service will save you maintenance effort.
What does it cost to set this up?
If you use existing monitoring tools (e.g., Grafana, Elasticsearch), the cost is mainly your time. Managed anomaly detection services like AWS OpenSearch have per-hour pricing; check the vendor for current rates.
Is a single anomalous concurrency value enough to block a visitor?
No. As BotRefund states, “A single anomaly is not a bot verdict.” Always combine concurrency data with other behavioral signals before taking action.
How does BotRefund use CPU concurrency in its detection?
BotRefund runs the CPU Concurrency Lie check as “one of 106 independent checks.” It looks for a mismatch that a real browsing session would not create, then cross-checks it against browser, network, device, and behavior data before making a prediction.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
How BotRefund can help
BotRefund is a bot-detection service that includes the CPU Concurrency Lie check as part of 106 independent signals. Instead of relying on a single anomaly, BotRefund cross-checks that signal with browser, network, device, and behavioral data before making a determination. You can add BotRefund to your website in about one minute and get a free bot audit. It uses AI prediction to weigh the complete pattern, so you don't have to configure thresholds or baseline yourself.