Skip to content

Cost Model

ixtract estimates the cost of each candidate plan before execution, then shows you the trade-off. You declare your rates; ixtract applies them to the planned workers, estimated duration, and estimated egress.

Cost is an estimate, not a guarantee. All rates default to zero. If you don’t declare rates, no cost is shown.

cost = (workers × duration_estimate) × compute_rate
+ (estimated_output_gb) × egress_rate
+ (workers) × connection_rate
  • compute_rate: cost per worker-second (e.g., EC2 hourly ÷ 3600 ÷ vCPUs)
  • egress_rate: cost per GB of output data
  • connection_rate: cost per connection-second (for managed databases with per-connection pricing)

Duration estimate comes from the estimator (EWMA + context similarity blend). For first runs with no history, it uses the profiler’s latency estimate.

ixtract generates candidate plans at different worker counts, filters dominated candidates, and shows the comparison:

Cost Comparison (estimated, rates user-declared)
────────────────────────────────────────────────
workers duration cost
2 ~12s $0.13 ← planned
3 ~12s $0.13
4 ~13s $0.15
8 ~14s $0.21

The planned option is the one ixtract selected. You can override with --max-workers if you prefer a different trade-off.

A candidate is “dominated” if another candidate is cheaper and faster. Dominated candidates are filtered from the comparison table.

Terminal window
ixtract plan orders \
--compute-rate 0.05 \
--egress-rate 0.01 \
--connection-rate 0.001

Or from a file:

Terminal window
ixtract plan orders --cost-file rates.json

rates.json:

{
"compute_rate": 0.05,
"egress_rate": 0.01,
"connection_rate": 0.001
}
from ixtract import CostConfig, plan
cost = CostConfig(
compute_rate=0.05,
egress_rate=0.01,
connection_rate=0.001,
)
result = plan(intent, cost_config=cost)
if result.cost_estimate:
print(f"Estimated cost: ${result.cost_estimate.total:.2f}")

CostConfig validates that all rates are non-negative and no unknown fields are present.

For a cloud VM running the extraction:

compute_rate = hourly_vm_cost / 3600 / vcpu_count

Example: $0.192/hr VM, 4 vCPUs → compute_rate = 0.192 / 3600 / 4 = 0.0000133

For a managed service with per-hour billing, divide by the total seconds per hour.

Cloud providers typically charge $0.08–$0.12 per GB for data leaving a region. Check your provider’s pricing page.

Example: AWS us-east-1 → egress_rate = 0.09

For managed databases with per-connection pricing (e.g., RDS Proxy, Azure SQL serverless), declare the per-second cost of holding a connection open.

Most setups: connection_rate = 0.

  • No defaults are ever applied. If you don’t declare a rate, that component of cost is zero.
  • Cost does not affect the plan. The planner optimizes for throughput; cost is displayed alongside the plan, not used to select it.
  • Rates are user-declared, not system-measured. ixtract does not call any pricing API.
  • Comparison uses the same estimator as the plan. Candidates are evaluated with identical assumptions.