project-nomad/admin/database/migrations/1769097600001_create_benchmark_results_table.ts
Chris Sherwood 755807f95e feat: Add system benchmark feature with NOMAD Score
Add comprehensive benchmarking capability to measure server performance:

Backend:
- BenchmarkService with CPU, memory, disk, and AI benchmarks using sysbench
- Database migrations for benchmark_results and benchmark_settings tables
- REST API endpoints for running benchmarks and retrieving results
- CLI commands: benchmark:run, benchmark:results, benchmark:submit
- BullMQ job for async benchmark execution with SSE progress updates
- Synchronous mode option (?sync=true) for simpler local dev setup

Frontend:
- Benchmark settings page with circular gauges for scores
- NOMAD Score display with weighted composite calculation
- System Performance section (CPU, Memory, Disk Read/Write)
- AI Performance section (tokens/sec, time to first token)
- Hardware Information display
- Expandable Benchmark Details section
- Progress simulation during sync benchmark execution

Easy Setup Integration:
- Added System Benchmark to Additional Tools section
- Built-in capability pattern for non-Docker features
- Click-to-navigate behavior for built-in tools

Fixes:
- Docker log multiplexing issue (Tty: true) for proper output parsing
- Consolidated disk benchmarks into single container execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 21:48:12 -08:00

48 lines
1.6 KiB
TypeScript

import { BaseSchema } from '@adonisjs/lucid/schema'
export default class extends BaseSchema {
protected tableName = 'benchmark_results'
async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.string('benchmark_id').unique().notNullable()
table.enum('benchmark_type', ['full', 'system', 'ai']).notNullable()
// Hardware information
table.string('cpu_model').notNullable()
table.integer('cpu_cores').notNullable()
table.integer('cpu_threads').notNullable()
table.bigInteger('ram_bytes').notNullable()
table.enum('disk_type', ['ssd', 'hdd', 'nvme', 'unknown']).notNullable()
table.string('gpu_model').nullable()
// System benchmark scores
table.float('cpu_score').notNullable()
table.float('memory_score').notNullable()
table.float('disk_read_score').notNullable()
table.float('disk_write_score').notNullable()
// AI benchmark scores (nullable for system-only benchmarks)
table.float('ai_tokens_per_second').nullable()
table.string('ai_model_used').nullable()
table.float('ai_time_to_first_token').nullable()
// Composite NOMAD score (0-100)
table.float('nomad_score').notNullable()
// Repository submission tracking
table.boolean('submitted_to_repository').defaultTo(false)
table.timestamp('submitted_at').nullable()
table.string('repository_id').nullable()
table.timestamp('created_at')
table.timestamp('updated_at')
})
}
async down() {
this.schema.dropTable(this.tableName)
}
}