data-platform-cost-optimization
Find and reduce data platform spend by measuring cost drivers, detecting idle resources, right-sizing compute, and setting budget alerts on Databricks and Microsoft Fabric. Use when analyzing DBU or capacity unit consumption, querying system.billing tables, installing or reading the Fabric Capacity Metrics app, finding idle clusters or underutilized capacities, right-sizing clusters or SKUs, pausing Fabric capacities off-hours, configuring budget alerts, or answering why the platform bill went up.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-27
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- data-platform-cost-optimization
- description
- Find and reduce data platform spend by measuring cost drivers, detecting idle resources, right-sizing compute, and setting budget alerts on Databricks and Microsoft Fabric. Use when analyzing DBU or capacity unit consumption, querying system.billing tables, installing or reading the Fabric Capacity Metrics app, finding idle clusters or underutilized capacities, right-sizing clusters or SKUs, pausing Fabric capacities off-hours, configuring budget alerts, or answering why the platform bill went up.
03 SKILL.md 正文
Data Platform Cost Optimization
Outcome
A quantified cost baseline, a ranked list of savings actions with expected impact, and verified savings that did not break workload SLOs.
Setup
Databricks cost data lives in system tables and the CLI. Authenticate as for any workspace work (profile or DATABRICKS_HOST plus service-principal env vars; never write tokens into files, prompts, logs, or artifacts):
databricks --version # keep current; system table coverage grows over time
databricks current-user me # confirm identity and workspace before querying
Querying system.billing.usage and system.billing.list_prices requires access to the system catalog (granted by an account admin); run the SQL in a SQL warehouse or notebook on a workspace with system tables enabled.
Fabric cost data lives in the Capacity Metrics app and Azure APIs. Install fab and authenticate (fab auth login, or a service principal via env vars). Reading the Capacity Metrics app requires capacity admin; listing capacities via Azure REST requires read access on the Fabric capacity resources.
Where the money goes
- Databricks: every workload bills in DBUs against a SKU. Key drivers: all-purpose (interactive) clusters cost several times more per DBU-hour than job compute for the same work; serverless jobs, pipelines, and notebooks bill per use; SQL warehouses bill while running; idle all-purpose clusters without autotermination are the classic leak.
billing_origin_productandproduct_features.is_serverlessinsystem.billing.usageseparate these. - Fabric: a capacity is a fixed pool of Capacity Units (CUs) at an SKU price (F2…F2048). Cost drivers: sustained background operations (Spark, pipelines, refreshes), throttling from overcommit, and paying for a capacity that sits idle off-hours. Pausing a capacity stops billing; overages are billed when you pause.
Measure: gather cost data (read-only)
Daily DBU consumption by SKU and workspace (Databricks SQL):
SELECT usage_date, sku_name, workspace_id,
SUM(usage_quantity) AS dbus
FROM system.billing.usage
WHERE usage_date >= current_date() - INTERVAL 30 DAYS
GROUP BY ALL
ORDER BY dbus DESC;
Top clusters and jobs by consumption, handling retraction/restatement corrections:
SELECT usage_metadata.cluster_id, usage_metadata.job_id,
billing_origin_product, SUM(usage_quantity) AS dbus
FROM system.billing.usage
WHERE usage_date >= current_date() - INTERVAL 30 DAYS
GROUP BY ALL
HAVING dbus != 0
ORDER BY dbus DESC
LIMIT 25;
Convert DBUs to money by joining system.billing.list_prices on sku_name and the most recent price_start_time, using pricing.default (list price). Note that billing records typically land within 12 hours and may be corrected later.
Fabric capacities and their state (read-only):
fab api capacities # list capacities the identity can see
curl "https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/capacities?api-version=2023-11-01" \
-H "Authorization: Bearer $AZURE_TOKEN"
For CU-level detail, install the Microsoft Fabric Capacity Metrics app (capacity admin) and read the Compute page: 14-day utilization, throttling, and the matrix of operations by item. Its data lags 10–15 minutes.
Idle-resource detection and right-sizing
Read-only detection first; change only with approval.
- Databricks clusters: list all-purpose compute and check autotermination and last activity —
databricks clusters list. Clusters with noautotermination_minutes, running for days with low usage, or sized far above their jobs are candidates. Attribute spend viausage_metadata.cluster_id. - SQL warehouses and serverless: warehouses with long idle windows and tiny query counts; serverless usage where classic job compute would be cheaper, or vice versa.
- Right-size: move scheduled workloads from all-purpose to job compute; enable autoscaling; cap waste with compute policies (max DBUs per hour, fixed node types, enforced autotermination). Policy changes to running compute restart it — treat as mutating.
- Fabric: find capacities with low sustained CU% in the Metrics app; downsize the SKU, or pause off-hours capacities via the Azure REST Suspend/Resume operations or an Azure runbook schedule. Pausing a production capacity is destructive to availability — gate it behind explicit approval and confirm nothing depends on it.
Budget alerts
- Azure (covers Fabric capacities and Databricks on Azure): create Cost Management budgets at subscription or resource-group scope with actual-cost and forecast thresholds; alerts email within about an hour of evaluation. Needs Cost Management contributor; reader can only view.
- Databricks: schedule the spend queries above as a job and alert on threshold breaches; track
usage_policy_idinsystem.billing.usageto attribute serverless spend to usage policies.
Agent-safe workflow
- Measure (read-only): run the queries and listings above; build the baseline.
- Identify: rank findings by spend and confidence; state expected savings per action.
- Recommend and get approval: present each mutating action (edit cluster, apply policy, resize or pause capacity) with its blast radius. Deleting compute or pausing a production capacity requires explicit approval each time.
- Execute the approved actions one at a time.
- Verify: re-query spend after the billing latency window and confirm workload SLOs still hold. Savings that break pipelines are not savings.
Permission boundaries
- Read: workspace access plus SELECT on
system.billing.*(account-admin granted); Fabric capacity admin (or Metrics app share) for CU detail; Azure reader for capacity listings. - Change: CAN MANAGE on the specific Databricks compute; compute-policy authoring needs workspace admin. Fabric SKU changes and pause/resume need Azure RBAC on the capacity resource (
Microsoft.Fabric/capacities/write,suspend/action,resume/action) — a custom role, not a broad privileged role.
Troubleshooting
system.billing.usagereturns nothing: system tables are not enabled for the workspace, or the principal lacks access. Ask an account admin to enable and grant access; records for new workspaces can take longer than 12 hours.- Spend numbers change retroactively: corrections arrive as
RETRACTION/RESTATEMENTrecords. AlwaysSUM(usage_quantity)across record types rather than filtering toORIGINAL. - Cluster/job attribution columns are null:
usage_metadatafields populate only for the relevant compute type — serverless usage has nocluster_id. Joinsystem.compute.clustersfor all-purpose cluster ownership. - Cost estimate disagrees with the invoice: you joined list prices from the wrong window or missed negotiated discounts. Use the latest
price_start_timeon or before the usage date and treat results as list-price estimates. - Fabric Metrics app shows no data for a new capacity: dimensions refresh on a scheduled model refresh; trigger a manual refresh and re-check the
RegionNameparameter. - Throttling after downsizing a Fabric capacity: the SKU no longer fits peak load. Review the Metrics app Timepoint page, spread background operations, or scale back up.
Documentation
- Databricks billable usage system table (
system.billing.usage) - Databricks pricing system table (
system.billing.list_prices) - Databricks compute policies
- Databricks CLI and authentication
- Microsoft Fabric Capacity Metrics app
- Pause and resume a Fabric capacity
- Fabric Capacities Azure REST API
- Create and manage Azure budgets
- Microsoft Fabric CLI (
fab)
Shared resources
Load only the resources needed for the current task. The links resolve inside the current agent package.
../../references/reliability-and-slo-guide.md../../references/security-control-baseline.md
Completion check
The work is done when there is a measured baseline, each recommended action carries an expected saving and an approval state, executed actions show reduced consumption in system.billing.usage or the Capacity Metrics app after the latency window, and no workload SLO regressed. A recommendation without a measured baseline is a guess, not an optimization.
04 同仓库更多 Skills
twenty-year-land-plan
Apply the Bren discipline of evaluating every land and development decision on a twenty-year horizon, with a comprehensive plan for how the land, the community, and the surrounding public infrastructure evolve together. Deals optimized for a five-year exit are structurally different from deals that compound across generations; insist on knowing which kind you are making. Use when evaluating land, entitlements, master-planned development, or phasing decisions, and when separating five-year exit deals from generational holds.
thematic-gut-check
Apply the Gray discipline of identifying the structural theme behind every real estate deal, testing where that theme sits in its capital-flow lifecycle, and insisting that deals without a named theme — or deals late in a crowded theme — clear a higher bar. A mediocre deal in a strong theme usually beats a clever deal in a weak one. Use when naming the structural thesis behind a deal, judging whether that theme is early or crowded, and setting the bar the deal must clear.
supply-pipeline-gut-check
Apply the Zell discipline of grounding every real estate thesis in the local supply pipeline. Demand counts over adjectives — units under construction, units permitted, units proposed — and convert them into a forward absorption schedule. A deal that ignores the pipeline is a bet on a market you have not actually studied. Use when validating a market thesis, forecasting absorption and rent growth, or counting units under construction, permitted, and proposed.
ruin-scenario-mapping
Apply the Taleb discipline of identifying, for every real estate deal, the specific chain of events that produces ruin — permanent, unrecoverable capital loss — and verifying that no single such chain has non-trivial probability. Deals with any plausible ruin path must be restructured or abandoned. Use when sizing leverage, testing refinancing, covenant, and liquidity risk, or checking whether any single failure chain can permanently wipe out the position.
revenue-cost-architecture
Design a venture's revenue streams, pricing logic, cost structure, and unit economics so the business model has a coherent theory of value capture, not just value creation. Use after the value proposition and customer segment are set and before financial projections, when choosing a pricing model, calculating contribution margin or CAC payback, or checking whether the unit economics hold at scale.
replacement-cost-stress-test
Apply the Buffett discipline of pricing every real estate asset against the cost to rebuild it from scratch. The ratio of purchase price to replacement cost sets a ceiling on long-run downside: below replacement cost, new supply cannot profitably undercut you; at or above it, you are buying a liability disguised as an asset. Use when setting a purchase price, judging downside protection, or testing how exposed an asset is to newly built competing supply.