Is Shared CPU a Good Fit for Bots That Scrape or Poll APIs All Day?

In modern cloud architectures, cost optimization remains a critical discipline, especially when operating always-on workloads such as bots that scrape or poll APIs continuously. These workloads often exhibit a steady-low CPU usage pattern punctuated by occasional spikes. Choosing the right instance type is vital to balancing cost and performance. Among the many options, shared CPU instances seem attractive due to their lower cost, but is this a smart choice for bot workloads bounded by rate limiting and bursty behavior?

In this article, we’ll explore the nuances of shared CPU offerings across major cloud providers, discuss the pitfalls of average CPU utilization as a metric, and provide practical guidance on how to leverage cloud-native tools like AWS Compute Optimizer and Azure Advisor for data-driven decisions. We'll emphasize why understanding P95 and P99 CPU percentiles and spike durations are more impactful than averages.

Understanding Bot Workloads: More Than Just "Idle"

Bots that scrape websites, poll APIs, or process message queues typically run always-on, executing periodic or event-driven API calls. The key performance and cost drivers are:

image

    Steady-low CPU use: Between requests, the bot often idles or performs minimal processing. Bursty CPU spikes: Spikes occur when making API calls, processing responses, or retrying failed requests. Rate limiting constraints: The bot cannot exceed API rate limits, so sustained high CPU utilization often reflects inefficiencies, not faster work.

On the surface, these appear like ideal candidates for low-cost, shared CPU instances. However, many engineering teams err by focusing on average CPU utilization metrics, which can mask those transient spikes that cause throttling, poor reliability, or degraded throughput.

Why averages hurt your decision-making

Imagine observing a bot with 15% average CPU, but it exhibits short, frequent Click for more spikes to 80% CPU lasting a few seconds. If your decision to pick an instance class is based solely on that 15% average, you will likely:

    Underprovision — causing throttled or delayed retries Miss opportunities to optimize concurrency and burst capacity Potentially increase complexity with retries or dead-letter queues to compensate
These downsides compound operationally and financially.

Shared CPU: Definitions Vary by Cloud Provider

“Shared CPU” does not mean the same thing everywhere.

Provider Shared CPU Definition Common Instance Families Key Characteristics AWS Baseline CPU credits with ability to burst above baseline using accumulated credits T3, T4g (Graviton2/3), T4a CPU credits accumulate when under baseline; burst when available; vCPU vs. physical CPU cores Azure Burstable VMs with a baseline percentage of CPU performance and ability to burst beyond B-Series (B1s, B2s, etc.) Earn credits during low use; credits consumed during burst; limits based on VM size

The cardinal difference is that these instances are designed to deliver a guaranteed baseline with the ability to burst using credit systems. However, real-world bot workloads with erratic burst durations and frequencies may exhaust credits, resulting in throttling.

Beware of treating vCPU count as a performance guarantee

One common misconception is equating the number of vCPUs to guaranteed consistent compute power. Shared CPU models often share cores with multiple tenants, and unless you monitor and manage burst credits carefully, your bot can experience degraded latency or failures during peak demands.

Measuring Peaks: The Right Observation Window and Metrics

The key to selecting an appropriate instance type lies in these questions:

What do the P95 and P99 CPU utilization percentiles look like? How long do spike bursts last? How often do bursts repeat, and does credit exhaustion happen?

P95 and P99 percentiles: capturing the tail end

Instead of average CPU usage, examine the 95th and 99th percentile CPU utilization over relevant windows (5 minutes, 15 minutes, 1 hour depending on workload cadence). These percentiles reflect the upper range spikes that dictate caching, throttling, and bottlenecks.

Why spike duration matters

Short spikes lasting a few seconds may be fine on lightweight shared CPU instances. Long spikes that exceed burst credit windows can cause your workload to slow or stall. Measure spike durations to understand operational impact.

Choosing the observation window: align with your workload

API polling bots often issue requests every few seconds to minutes. Use observation windows that correlate with this interval rather than arbitrary hourly averages. This reveals transient bottlenecks that averages smooth over.

Leveraging Cloud-Native Tools for Cost and Performance Insights

Cloud providers offer tooling that integrates CPU metrics, burst credit tracking, and utilization patterns, helping you make informed choices.

AWS Compute Optimizer

AWS Compute Optimizer analyzes utilization patterns over 14 days and recommends instance families and sizes that balance cost and performance. Highlights include:

    Insights on burst credit usage for T-series instances Recommendations based on P95 CPU utilization rather than averages Ability to simulate results for different instance types, including Graviton-based options

When running shared CPU workers like bots, AWS Compute Optimizer can show if you're exhausting CPU credits frequently, suggesting the need for larger or dedicated t4g burstable performance CPU instances.

Azure Advisor

Azure Advisor offers similar insights for B-series VMs with burstable CPU:

    Real-time CPU credit balance tracking Performance bottleneck alerts Cost recommendations to resize or switch VM family

Azure Advisor’s ability to correlate credit consumption with CPU spikes is critical for bots to avoid capacity throttling that impacts API polling rates.

image

Best Practices for Using Shared CPU Instances with Bot Workloads

Always review P95/P99 CPU utilization and burst credit history before migration. Use monitoring tools with spike duration analysis (e.g. CloudWatch, Azure Monitor) to understand burst patterns. Implement retries and backoff rooted in application-layer awareness of rate limiting – don’t rely solely on instance capacity. Test pilot fleets on shared CPU instances with strict rollback criteria based on increased latency or API call failures. Consider dedicated CPU instance types for bots with consistently high or sustained CPU spikes. Analyze network egress and storage impacts – sometimes cost surprises arise there, hidden by vCPU-only metrics.

Example rollback criteria

    If P99 CPU utilization > 80% for > 10 minutes continuously on shared CPU instances Increase in API error rates or retries beyond baseline on shared CPU fleet Depletion of CPU credits draining faster than 5% per hour on average

Always predefine these criteria and monitor closely during pilot deployments to avoid unexpected degradation.

Conclusion: Is Shared CPU a Good Fit?

Shared CPU instances offer attractive cost savings for bot workloads with steady-low CPU usage interspersed by occasional bursts — provided you have the right visibility and controls in place.

Key takeaways:

    Don't base decisions on average CPU metrics alone; analyze P95/P99 percentiles and burst durations. Shared CPU definitions and burst credit systems differ between AWS and Azure—understand how each provider manages CPU resources. Leverage cloud-native tools like AWS Compute Optimizer and Azure Advisor for targeted recommendations. Set up thorough monitoring and rollback criteria before migrating workloads.

With disciplined measurement, pilot testing, and application-aware rate limiting strategies, shared CPU can be an effective and efficient platform for API scraping or polling bots operating at scale.

Have you used shared CPU instances for bot workloads? What metrics or tools helped you decide? Share your experiences and questions below.