-
-
-
宿主机控制
-
超售容量、KSM 与宿主机内存参数
-
-
-
-
-
- }
- label="已分配 vCPU"
- value={String(status?.allocated_cpu || 0)}
- hint={`超售倍数: ${config.cpu_overcommit}x`}
- />
- }
- label="已分配内存"
- value={formatMB(status?.allocated_ram_mb || 0)}
- hint={`超售倍数: ${config.ram_overcommit}x`}
- />
- }
- label="已分配磁盘"
- value={`${status?.allocated_disk_gb || 0} GB`}
- hint={`超售倍数: ${config.disk_overcommit}x`}
- />
-
-
-
-
超售倍数
-
- setConfig({ ...config, cpu_overcommit: v })}
- hint="只用于容量估算,不改变单台容器限制"
- />
- setConfig({ ...config, ram_overcommit: v })}
- hint="只用于容量估算,不改变单台容器限制"
- />
- setConfig({ ...config, disk_overcommit: v })}
- hint="用于容量预估,实际写入仍受文件系统限制"
- />
-
-
-
-
-
-
容量预估
- 按单台容器配置计算
-
-
-
-
- setEstimateSpec({ ...estimateSpec, vcpu: value })}
- />
- setEstimateSpec({ ...estimateSpec, ramMb: value })}
- />
- setEstimateSpec({ ...estimateSpec, diskGb: value })}
- />
-
-
- {estimate && (
-
-
-
预计最多可开
-
{estimate.remainingCount}
-
- 理论上限 {estimate.totalCount} 台,当前受 {estimate.bottleneckLabel} 限制
-
-
-
-
-
-
- | 资源 |
- 实际 |
- 超售后 |
- 已分配 |
- 剩余可开 |
-
-
-
- {estimate.rows.map((row) => (
-
- | {row.label} |
- {row.actual} |
- {row.capacity} |
- {row.allocated} |
- {row.remainingCount} |
-
- ))}
-
-
-
-
- )}
-
-
-
-
-
内存优化
-
-
setConfig({ ...config, ksm_enabled: v })}
- extra={ksmSupported ? `已合并 ${status?.ksm_pages || 0} 页` : '当前内核不支持 KSM'}
- />
- setConfig({ ...config, swappiness: v })}
- hint="写入 /proc/sys/vm/swappiness,值越低越少使用 swap"
- />
-
-
-
-
-
-
-
-
- )
-}
-
-function ResourceCard({ icon, label, value, hint }: {
- icon: ReactNode
- label: string
- value: string
- hint: string
-}) {
- return (
-
-
- {label}
- {value}{suffix}
-
-
onChange(parseInt(e.target.value, 10) || min)}
- className="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-black"
- />
-
- {min}{suffix}{max}{suffix}
-
- {hint &&
{hint}
}
-
- )
-}
-
-function NumberField({ label, value, min, step = 1, onChange }: {
- label: string
- value: number
- min: number
- step?: number
- onChange: (value: number) => void
-}) {
- return (
-