Choosing the Right Sentry Sampling Strategy for High‑Throughput Production
High‑traffic apps can overwhelm Sentry if all traces are sent. This guide shows how to decide between client‑side, server‑side, and dynamic sampling, compares trade‑offs, and walks through a concrete setup and validation.
19 Nov 2025, 01:13 UTC

The Decision Problem
In a busy production environment, every HTTP request can generate a trace. Sending all traces to Sentry quickly exhausts your quota and can slow the client application. The core decision is how aggressively you want to sample traces while still retaining enough data to diagnose performance regressions.
Sampling Options Overview
- Client‑Side Sampling – The SDK decides before the trace leaves the application.
- Server‑Side Sampling – All traces reach Sentry, then the platform drops a portion.
- Dynamic Sampling – Sentry’s algorithm adjusts rates in real time based on traffic.
- Transaction vs. Error Sampling – Errors are captured at 100% by default; only transactions are sampled.
Trade‑Offs
| Feature | Client‑Side | Server‑Side | Dynamic |
|---|---|---|---|
| Network Overhead | Lower – only sampled traces are sent | Higher – all traces are transmitted | Moderate – depends on current rate |
| CPU Impact on App | Minimal – simple probability check | None – decision made after send | None – decision made at ingest |
| Granularity Control | Per‑SDK, per‑environment | Global per‑project, can be changed without redeploy | Automatic, no manual tuning |
| Cost Predictability | Predictable – you set the rate | Unpredictable – depends on traffic bursts | Predictable once you know the target rate |
| Implementation Effort | Code change + redeploy | UI change, no code | Enable in UI, no code |
Decision Matrix
Use the table below to match your constraints with the appropriate strategy. The key columns are Traffic Volume, Quota Constraints, and Operational Complexity.
| Scenario | Recommended Strategy | Why? |
|---|---|---|
| Low traffic, tight budget | Client‑Side 10–20% | Minimizes bandwidth and cost while still capturing most performance data. |
| High traffic, moderate budget, need quick rollback | Server‑Side 10–20% | Adjust rate in UI without redeploy; still sends all data to Sentry for richer analysis if needed. |
| Very high traffic, dynamic load spikes | Dynamic Sampling (tiered) | Automatically throttles during traffic surges, keeping within quota. |
| Critical latency monitoring | Client‑Side 100% + selective server‑side drop | Ensures every latency event is captured, then drop less critical transactions. |
Concrete Implementation & Validation
1. Client‑Side Sampling (Node.js Example)
// server.js
const Sentry = require('@sentry/node');
Sentry.init({
dsn: 'https://[contact removed]/0',
tracesSampleRate: 0.1, // 10% of transactions
});
Run the application with node server.js. The SDK will randomly decide to send a trace 10% of the time.
2. Server‑Side Sampling (UI)
- Navigate to Project Settings → Performance → Sample Rate.
- Set the desired percentage (e.g., 10%).
- Save changes – no code redeploy needed.
3. Dynamic Sampling (Enterprise Tier)
- Enable Dynamic Sampling in the project settings.
- Configure the target sample rate (e.g., 5%) and the maximum transaction count per minute.
- Save and monitor the Dynamic Sampling section for real‑time adjustments.
4. Validation Steps
- Generate a known number of requests (e.g., via a load test). Log the total request count locally.
- In Sentry, open the Transactions tab and note the Count displayed.
- Calculate the effective sample rate:
transactions / total_requests. It should approximate the configured rate. - Trigger a deliberate exception (e.g., throw new Error('Test')). Verify it appears in the Issues list; error sampling remains at 100%.
- Check the Quota usage in the project settings to ensure you are within limits.
Practical Checks & Limits
- Client‑Side sampling only reduces outbound traffic; it does not reduce the time the SDK spends creating the transaction.
- Server‑Side sampling still incurs network bandwidth to Sentry; it only saves storage and processing cost.
- When mixing SDKs (e.g., browser + Node), ensure both use the same
tracesSampleRateor propagate asampledflag in trace context. - Dynamic Sampling is available only on Premium and above; lower tiers must rely on static rates.
- Always keep an eye on the Performance Dashboard for sudden drops in transaction count, which may indicate mis‑configured sampling.
Next Steps
Start with a conservative client‑side rate (e.g., 5–10%) and monitor both Sentry’s quota usage and application performance. If you hit quota limits during traffic spikes, consider enabling dynamic sampling or moving to server‑side sampling with a lower rate. Document the chosen strategy in your observability playbook so future teams can adjust without re‑engineering the SDK code.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.