Skip to content

[WIP] ExternalPush scaler doesn't respect other scalers activity to scale to zero#7098

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-20119154-6ce0-4c79-b6c7-c027988c3408
Closed

[WIP] ExternalPush scaler doesn't respect other scalers activity to scale to zero#7098
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-20119154-6ce0-4c79-b6c7-c027988c3408

Conversation

Copy link
Copy Markdown

Copilot AI commented Sep 24, 2025

Fix ExternalPush Scaler Scale-to-Zero Issue ✅

Problem: ExternalPush scalers currently don't respect other scalers' activity when scaling to zero. When an external push scaler reports inactive, it immediately scales to zero even if other scalers are still active (e.g., HTTP + cron scenario).

Solution Plan:

  • Analyze current implementation in startPushScalers and GetPushScalers
  • Understand the relationship with scaling modifiers
  • Implement fix in startPushScalers to check all scalers before scaling to zero
  • Update GetPushScalers to exclude push scalers when scaling modifiers are used
  • Add proper error handling and logging
  • Test the changes
  • Verify the fix handles the reported use case (HTTP + cron scenario)

Key Changes:

  1. Modified startPushScalers: When an external push scaler reports inactive, now checks activity of all other scalers before scaling to zero
  2. Updated GetPushScalers: Returns empty array when IsUsingModifiers() is true, as suggested in the issue
  3. Added comprehensive tests: Created tests to validate the scaling modifiers behavior

Implementation Details:

  • Only external push scalers reporting inactive trigger the additional scaler check
  • Active external push scalers still scale up immediately (preserving fast scale-from-zero)
  • When scaling modifiers are used, push scalers are disabled entirely
  • Maintains thread safety with existing mutex patterns

Validation Results:
Scenario 1: HTTP push inactive + Cron active → Does NOT scale to zero
Scenario 2: All scalers inactive → DOES scale to zero
Scenario 3: With scaling modifiers → Push scalers disabled
Scenario 4: Without scaling modifiers → Push scalers enabled
All existing tests pass: External push scaler tests, cache tests, etc.

Files Modified:

  • pkg/scaling/cache/scalers_cache.go - Updated GetPushScalers() method
  • pkg/scaling/scale_handler.go - Enhanced startPushScalers() logic
  • pkg/scaling/cache/scalers_cache_test.go - Added comprehensive tests

Fixes #6986


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExternalPush scaler doesn't respect other scalers activity to scale to zero

2 participants