Skip to content

fix: Remove Memory Management from Resource Limiter#2123

Merged
nimrod-teich merged 6 commits into
mainfrom
fix_resource_limiter_memory
Dec 4, 2025
Merged

fix: Remove Memory Management from Resource Limiter#2123
nimrod-teich merged 6 commits into
mainfrom
fix_resource_limiter_memory

Conversation

@avitenzer

Copy link
Copy Markdown
Collaborator
  1. Core Resource Limiter (resource_limiter.go)

    Removed Fields:

    • memoryThreshold - Maximum memory threshold in bytes
    • memoryLock - RWMutex for memory tracking
    • currentMemory - Current estimated memory usage
    • MemoryPerCall from MethodConfig struct
    • EstimatedMemoryUse from ResourceLimiterMetrics struct

    Removed Methods:

    • canAdmitRequest() - Checked if request would exceed memory threshold
    • reserveMemory() - Reserved memory for executing requests
    • releaseMemory() - Released memory after execution
    • monitorMemory() - Background goroutine monitoring heap usage
    • updateMemory() - Updated memory metrics

    Updated Function Signatures:

    • NewResourceLimiter() - removed memoryThresholdGB float64 parameter
    • newResourceLimiterForTesting() - removed memoryThresholdGB float64 parameter

    Removed Prometheus Metrics:

    • lava_provider_resource_limiter_memory_bytes - Estimated memory usage gauge

    Removed Imports:

    • runtime package (no longer needed)
  2. RPC Provider (rpcprovider.go)

    Removed:

    • memoryThresholdGB field from resourceLimiterOptions struct
    • --resource-limiter-memory-gb CLI flag
    • Memory threshold logging in resource limiter initialization

    Updated:

    • All calls to NewResourceLimiter() to remove memory parameter
    • Resource limiter info logs to exclude memory threshold

…alization

- Removed memory threshold management from ResourceLimiter, including related methods and metrics.
- Updated NewResourceLimiter and newResourceLimiterForTesting functions to eliminate memory threshold parameters.
- Adjusted tests to reflect changes in ResourceLimiter initialization and removed memory-related assertions.
- Enhanced resource limiter setup in RPCProvider to streamline configuration options.

This refactor improves clarity and reduces complexity in resource management, focusing on concurrent execution limits without memory constraints.
…o improve sync loss retry logic

- Introduced a clearer mechanism for tracking errored providers and determining if a sync loss is new and should be retried.
- Simplified the conditions for marking providers as unwanted, ensuring that all non-retryable errors and subsequent sync losses are handled appropriately.
- Added comments for better code clarity and maintainability.
@github-actions

github-actions Bot commented Dec 2, 2025

Copy link
Copy Markdown

Test Results

3 092 tests   - 2   3 091 ✅  - 1   31m 28s ⏱️ + 10m 49s
  126 suites ±0       1 💤 ±0 
    7 files   ±0       0 ❌ ±0 

Results for commit 28c365f. ± Comparison against base commit 1832ff4.

This pull request removes 2 tests.
github.com/lavanet/lava/v5/protocol/rpcprovider ‑ TestResourceLimiter_MemoryLimit
github.com/lavanet/lava/v5/protocol/rpcprovider ‑ TestResourceLimiter_MemoryReservationRelease

♻️ This comment has been updated with latest results.

@avitenzer avitenzer changed the title Fix: Remove Memory Management from Resource Limiter fix: Remove Memory Management from Resource Limiter Dec 2, 2025
- Updated tests for ResourceLimiter to improve clarity and coverage, including detailed comments for each test case.
- Introduced a timeout context for request queuing to handle cancellations and timeouts more effectively.
- Enhanced metrics verification to ensure accurate tracking of queued and rejected requests.
- Improved synchronization in concurrent request handling to prevent race conditions and ensure correct metrics reporting.
@nimrod-teich nimrod-teich merged commit ddac432 into main Dec 4, 2025
48 of 49 checks passed
@nimrod-teich nimrod-teich deleted the fix_resource_limiter_memory branch December 4, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants