Implement Phase 11: Auto-Scaler#14
Merged
Merged
Conversation
Add automatic scaling based on resource metrics with three components:
Resource Limits:
- ResourceLimits config struct for memory and table size limits
- Integration with Wasmtime's StoreLimits for enforcement
- Applied at Store creation in all runtime types (CLI, HTTP, TCP)
Metrics Collection:
- MetricsCollector tracks request counts, latencies, and instance counts
- Load calculation based on latency relative to configurable baseline
- Latency percentile calculations (avg, p50, p99)
- API endpoints: GET /v1/metrics, GET /v1/services/{id}/metrics
Auto-Scaler:
- AutoScaler monitors metrics and triggers scale up/down decisions
- Cooldown mechanism prevents scaling thrashing
- Respects min/max replica configuration per service
- ServiceAutoScaled event published on scaling actions
E2E Tests:
- 12 comprehensive tests for metrics collection and auto-scaling
- Tests verify registration, request tracking, load calculation
- Tests verify auto-scaler respects replica limits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 11 (Auto-Scaler) with automatic scaling based on resource metrics.
Resource Limits
ResourceLimitsconfig struct for memory and table size limitsStoreLimitsfor enforcementMetrics Collection
MetricsCollectortracks request counts, latencies, and instance countsGET /v1/metrics,GET /v1/services/{id}/metricsAuto-Scaler
AutoScalermonitors metrics and triggers scale up/down decisionsServiceAutoScaledevent published on scaling actionsNew Files
fabricks-runtime/src/limits.rs- Resource limits configurationfabricksd/src/scaler/- Scaler module (mod.rs, types.rs, metrics.rs, autoscaler.rs)fabricksd/src/api/handlers/metrics.rs- Metrics API handlersfabricks-e2e/tests/autoscaler.rs- E2E testsTest plan