Files
supabase/apps/studio/components/interfaces/DiskManagement/ui/DiskManagement.constants.tsx
Jordi Enric 022b510269 fix: centralize compute disk limits data and update documentation (#41242)
https://linear.app/supabase/issue/FE-2226/fix-incorrect-baseline-and-max-iopsthroughput-values

- Centralized compute/disk limits in
packages/shared-data/compute-disk-limits.ts (MB/s, baseline+max
IOPS/throughput) and re-exported from shared-data.
- Hooked Docs compute/disk table into shared data, converted docs
text/table to MB/s baseline/max.
- Removed duplicated compute IOPS/throughput constants from Studio,
Studio now imports shared data.
- Updated Studio disk schema: compute-aware MAX IOPS/throughput
validation (MB/s), defaults computeSize to ci_micro, and gp3/io2 checks
use compute caps.
- Clarified disk update mutation to send throughput as MB/s despite
backend throughput_mbps field name.
- Added tests for compute-size mappings and IOPS helper logic.
- Added Infra ownership for shared compute/disk data in CODEOWNERS.
- Locked zod version via catalog and added zod dep to shared-data.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a reusable Compute Disk Limits table and centralized compute
disk limits dataset for dynamic display.

* **Documentation**
* Replaced static per-size tables with a component-driven MB/s view;
clarified baseline vs. burst behavior and updated guides and
troubleshooting.

* **Bug Fixes**
* Validation and UI guidance now honor compute-size limits for IOPS and
throughput.

* **Tests**
  * Expanded unit tests for sizing, mappings, and edge cases.

* **Chores**
* Published shared-data exports, added a validation schema, pinned a
dependency, and added ownership entries.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-03 10:52:42 +00:00

84 lines
2.0 KiB
TypeScript

import { PlanId } from 'data/subscriptions/types'
// Disk Storage expands automatically when the database reaches 90% of the disk size
export const AUTOSCALING_THRESHOLD = 0.9
export enum DiskType {
GP3 = 'gp3',
IO2 = 'io2',
}
// [Joshen] As per https://github.com/supabase/platform/pull/20478
export const DISK_AUTOSCALE_CONFIG_DEFAULTS = {
growthPercent: 50,
minIncrementSize: 4,
maxSizeGb: 60000,
}
export const DISK_PRICING = {
[DiskType.GP3]: {
storage: 0.125, // per GB per month
iops: 0.024, // per IOPS per month, charged after 3000 IOPS
throughput: 0.095, // per MB/s per month, charged after 125 MB/s
},
[DiskType.IO2]: {
storage: 0.195, // per GB per month
iops: 0.119, // per IOPS per month
},
}
export const DISK_LIMITS = {
[DiskType.GP3]: {
minStorage: 1,
maxStorage: 16384,
minIops: 3000,
maxIops: 16000,
minThroughput: 125,
maxThroughput: 1000,
includedIops: 3000,
includedThroughput: 125,
},
[DiskType.IO2]: {
minStorage: 4,
maxStorage: 61440,
minIops: 1500,
maxIops: 256000,
includedIops: 0,
includedThroughput: 0,
},
}
interface PlanDetails {
includedDiskGB: { gp3: number; io2: number }
}
export const PLAN_DETAILS: Record<PlanId, PlanDetails> = {
free: { includedDiskGB: { gp3: 1, io2: 0 } },
pro: { includedDiskGB: { gp3: 8, io2: 0 } },
team: { includedDiskGB: { gp3: 8, io2: 0 } },
enterprise: { includedDiskGB: { gp3: 8, io2: 0 } },
platform: { includedDiskGB: { gp3: 8, io2: 0 } },
}
export const RESTRICTED_COMPUTE_FOR_IOPS_ON_GP3 = ['ci_nano', 'ci_micro', 'ci_small', 'ci_medium']
export const RESTRICTED_COMPUTE_FOR_THROUGHPUT_ON_GP3 = [
'ci_nano',
'ci_micro',
'ci_small',
'ci_medium',
]
export const DISK_TYPE_OPTIONS = [
{
type: 'gp3',
name: 'General Purpose SSD',
description: 'Balance between price and performance',
},
{
type: 'io2',
name: 'High Performance SSD',
description: 'High performance for mission critical applications',
},
]