mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 17:30:25 -04:00
022b510269
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 -->
181 lines
4.7 KiB
TypeScript
181 lines
4.7 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
/**
|
|
* [Jordi] Use instances.vantage.sh as source of truth for compute disk limits.
|
|
* Eg: https://instances.vantage.sh/aws/ec2/t4g.nano?currency=USD
|
|
*
|
|
* All compute from medium down are t4g and the bigger ones are m6g.
|
|
*
|
|
* Throughput values are stored in MB/s (AWS lists Mbps, so we convert with toMBps).
|
|
*/
|
|
|
|
export type ComputeDiskLimit = {
|
|
name: string
|
|
baselineIops: number
|
|
maxIops: number
|
|
baselineThroughputMBps: number
|
|
maxThroughputMBps: number
|
|
}
|
|
|
|
const toMBps = (throughputMbps: number) => Math.round(throughputMbps / 8)
|
|
|
|
export const COMPUTE_DISK = {
|
|
ci_nano: {
|
|
name: 'Nano (free)',
|
|
baselineIops: 250,
|
|
maxIops: 11800,
|
|
baselineThroughputMBps: toMBps(43),
|
|
maxThroughputMBps: toMBps(2085),
|
|
},
|
|
ci_micro: {
|
|
name: 'Micro',
|
|
baselineIops: 500,
|
|
maxIops: 11800,
|
|
baselineThroughputMBps: toMBps(87),
|
|
maxThroughputMBps: toMBps(2085),
|
|
},
|
|
ci_small: {
|
|
name: 'Small',
|
|
baselineIops: 1000,
|
|
maxIops: 11800,
|
|
baselineThroughputMBps: toMBps(174),
|
|
maxThroughputMBps: toMBps(2085),
|
|
},
|
|
ci_medium: {
|
|
name: 'Medium',
|
|
baselineIops: 2000,
|
|
maxIops: 11800,
|
|
baselineThroughputMBps: toMBps(347),
|
|
maxThroughputMBps: toMBps(2085),
|
|
},
|
|
ci_large: {
|
|
name: 'Large',
|
|
baselineIops: 3600,
|
|
maxIops: 20000,
|
|
baselineThroughputMBps: toMBps(630),
|
|
maxThroughputMBps: toMBps(4750),
|
|
},
|
|
ci_xlarge: {
|
|
name: 'XL',
|
|
baselineIops: 6000,
|
|
maxIops: 20000,
|
|
baselineThroughputMBps: toMBps(1188),
|
|
maxThroughputMBps: toMBps(4750),
|
|
},
|
|
ci_2xlarge: {
|
|
name: '2XL',
|
|
baselineIops: 12000,
|
|
maxIops: 20000,
|
|
baselineThroughputMBps: toMBps(2375),
|
|
maxThroughputMBps: toMBps(4750),
|
|
},
|
|
ci_4xlarge: {
|
|
name: '4XL',
|
|
baselineIops: 20000,
|
|
maxIops: 20000,
|
|
baselineThroughputMBps: toMBps(4750),
|
|
maxThroughputMBps: toMBps(4750),
|
|
},
|
|
ci_8xlarge: {
|
|
name: '8XL',
|
|
baselineIops: 40000,
|
|
maxIops: 40000,
|
|
baselineThroughputMBps: toMBps(9500),
|
|
maxThroughputMBps: toMBps(9500),
|
|
},
|
|
ci_12xlarge: {
|
|
name: '12XL',
|
|
baselineIops: 50000,
|
|
maxIops: 50000,
|
|
baselineThroughputMBps: toMBps(14250),
|
|
maxThroughputMBps: toMBps(14250),
|
|
},
|
|
ci_16xlarge: {
|
|
name: '16XL',
|
|
baselineIops: 80000,
|
|
maxIops: 80000,
|
|
baselineThroughputMBps: toMBps(19000),
|
|
maxThroughputMBps: toMBps(19000),
|
|
},
|
|
ci_24xlarge: {
|
|
name: '24XL',
|
|
baselineIops: 120000,
|
|
maxIops: 120000,
|
|
baselineThroughputMBps: toMBps(30000),
|
|
maxThroughputMBps: toMBps(30000),
|
|
},
|
|
ci_24xlarge_optimized_cpu: {
|
|
name: '24XL - Optimized CPU',
|
|
baselineIops: 120000,
|
|
maxIops: 120000,
|
|
baselineThroughputMBps: toMBps(30000),
|
|
maxThroughputMBps: toMBps(30000),
|
|
},
|
|
ci_24xlarge_optimized_memory: {
|
|
name: '24XL - Optimized Memory',
|
|
baselineIops: 120000,
|
|
maxIops: 120000,
|
|
baselineThroughputMBps: toMBps(30000),
|
|
maxThroughputMBps: toMBps(30000),
|
|
},
|
|
ci_24xlarge_high_memory: {
|
|
name: '24XL - High Memory',
|
|
baselineIops: 120000,
|
|
maxIops: 120000,
|
|
baselineThroughputMBps: toMBps(30000),
|
|
maxThroughputMBps: toMBps(30000),
|
|
},
|
|
ci_48xlarge: {
|
|
name: '48XL',
|
|
baselineIops: 240000,
|
|
maxIops: 240000,
|
|
baselineThroughputMBps: toMBps(40000),
|
|
maxThroughputMBps: toMBps(40000),
|
|
},
|
|
ci_48xlarge_optimized_cpu: {
|
|
name: '48XL - Optimized CPU',
|
|
baselineIops: 240000,
|
|
maxIops: 240000,
|
|
baselineThroughputMBps: toMBps(40000),
|
|
maxThroughputMBps: toMBps(40000),
|
|
},
|
|
ci_48xlarge_optimized_memory: {
|
|
name: '48XL - Optimized Memory',
|
|
baselineIops: 240000,
|
|
maxIops: 240000,
|
|
baselineThroughputMBps: toMBps(40000),
|
|
maxThroughputMBps: toMBps(40000),
|
|
},
|
|
ci_48xlarge_high_memory: {
|
|
name: '48XL - High Memory',
|
|
baselineIops: 240000,
|
|
maxIops: 240000,
|
|
baselineThroughputMBps: toMBps(40000),
|
|
maxThroughputMBps: toMBps(40000),
|
|
},
|
|
} as const satisfies Record<string, ComputeDiskLimit>
|
|
|
|
export type ComputeDiskKey = keyof typeof COMPUTE_DISK
|
|
|
|
export const COMPUTE_BASELINE_IOPS = Object.fromEntries(
|
|
Object.entries(COMPUTE_DISK).map(([key, value]) => [key, value.baselineIops])
|
|
)
|
|
|
|
export const COMPUTE_MAX_IOPS = Object.fromEntries(
|
|
Object.entries(COMPUTE_DISK).map(([key, value]) => [key, value.maxIops])
|
|
)
|
|
|
|
export const COMPUTE_BASELINE_THROUGHPUT = Object.fromEntries(
|
|
Object.entries(COMPUTE_DISK).map(([key, value]) => [key, value.baselineThroughputMBps])
|
|
)
|
|
|
|
export const COMPUTE_MAX_THROUGHPUT = Object.fromEntries(
|
|
Object.entries(COMPUTE_DISK).map(([key, value]) => [key, value.maxThroughputMBps])
|
|
)
|
|
|
|
const computeInstanceAddonVariantIds = Object.keys(COMPUTE_DISK) as ComputeDiskKey[]
|
|
|
|
export const computeInstanceAddonVariantIdSchema = z.enum(
|
|
computeInstanceAddonVariantIds as [ComputeDiskKey, ...ComputeDiskKey[]]
|
|
)
|