-
Notifications
You must be signed in to change notification settings - Fork 383
feat: Add horizontal vs vertical scaling simulator game #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,626
−0
Conversation
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
Implements issue #662 - Interactive simulator for learning scaling strategies - Add scaling-simulator component with comprehensive features: - Vertical scaling: Upgrade CPU, RAM, disk, and network - Horizontal scaling: Add/remove servers with load balancer - Auto-scaling: Configurable thresholds and instance limits - 4 difficulty scenarios: Gradual Growth, Sudden Spike, Variable Load, Black Friday - Real-time metrics: Traffic, response time, uptime, cost - Budget constraints with realistic AWS-like pricing - Educational guide panel explaining scaling concepts - Add game page with educational content and social sharing - Register game in lib/games.ts with proper metadata Closes #662
Deploying devops-daily with
|
| Latest commit: |
38f0ebf
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9c8248e1.devops-daily.pages.dev |
| Branch Preview URL: | https://feat-scaling-simulator.devops-daily.pages.dev |
- Limit manual server additions to maxInstances (10 by default) - Disable 'Add Server' button when at max capacity - Show 'Max 10' badge when limit reached instead of price
- Shows 'Remove Server' button when more than 1 server exists - Styled with red border/hover to indicate removal action - Shows -$20/mo badge to indicate cost savings - Removes the most recently added server
- When auto-scaling is enabled, system now scales up to meet minInstances requirement, not just when CPU threshold is exceeded - This ensures if minInstances is set to 5 with only 2 active servers, the system will automatically add servers to reach the minimum
- Added separate useEffect to monitor minInstances changes - Servers are added automatically (one at a time) when: - Auto-scaling is enabled - Load balancer is active - Current server count < minInstances - Works even when simulation is paused
- Auto-scaling now scales down when server count exceeds new minInstances - Removes servers one at a time with 500ms delay - Still maintains at least 1 server
The second useEffect was unconditionally scaling down servers when count exceeded minInstances, which conflicted with the CPU-based auto-scaling in the game loop. Now the useEffect only handles scaling UP to meet minimum requirements, while CPU-based scale-up and scale-down remain controlled by the game loop thresholds.
- Calculate avgLoad synchronously before state update (was using stale data) - Reduce scaleUpDelay from 30s to 5s for faster response to spikes - The CPU threshold check now uses current tick's load, not previous tick
Displays all component prices (CPU, RAM, disk, network) in a clear grid layout so users understand costs before upgrading.
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 issue #662 - Add Horizontal vs Vertical Scaling Interactive Simulator
Changes
New Files
components/games/scaling-simulator.tsx- Main game componentapp/games/scaling-simulator/page.tsx- Game page with educational contentModified Files
lib/games.ts- Added scaling simulator to games listFeatures
Scaling Options
Scenarios
Metrics Dashboard
Educational Content
Closes #662