Skip to content

improvements mid apr 2025 #24

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

lukaszraczylo
Copy link
Owner

@lukaszraczylo lukaszraczylo commented Apr 13, 2025

GraphQL Monitoring Proxy - April 2025 Improvements

This document summarizes the changes in the improvements-mid-apr-2025 branch compared to the main branch.

Circuit Breaker Implementation

A new circuit breaker feature has been added for fault tolerance using the Sony GoBreaker library:

  • Circuit breaker trips after configurable consecutive failures and automatically recovers
  • Includes fallback mechanism to serve cached responses when circuit is open
  • Configurable via environment variables:
    • ENABLE_CIRCUIT_BREAKER
    • CIRCUIT_MAX_FAILURES - Default: 5
    • CIRCUIT_TIMEOUT_SECONDS - Default: 30
    • CIRCUIT_MAX_HALF_OPEN_REQUESTS - Default: 2
    • CIRCUIT_RETURN_CACHED_ON_OPEN - Default: true
    • CIRCUIT_TRIP_ON_TIMEOUTS - Default: true
    • CIRCUIT_TRIP_ON_5XX - Default: true
  • Full test suite included for circuit breaker functionality

Memory Cache Improvements

Enhanced memory-aware caching with:

  • Configurable memory limits through:
    • CACHE_MAX_MEMORY_SIZE - Default: 100MB
    • CACHE_MAX_ENTRIES - Default: 10,000
  • Memory monitoring for cache utilization tracking
  • Smart eviction strategies to prevent out-of-memory situations
  • Enhanced memory usage tracking and metrics reporting
  • Compression for large cache entries
  • Tests for cache eviction and compression strategies

GraphQL Parsing Optimizations

Performance improvements in GraphQL handling:

  • Query parsing cache to prevent redundant parsing of identical queries
  • Performance metrics for GraphQL parsing operations
  • Optimized mutation detection and endpoint routing logic
  • Improved memory management during GraphQL operations
  • Enhanced introspection query handling for better security

HTTP Client Enhancements

Optimized HTTP client configuration with:

  • Improved defaults for better performance
  • Granular timeout controls via:
    • CLIENT_READ_TIMEOUT
    • CLIENT_WRITE_TIMEOUT
    • CLIENT_MAX_IDLE_CONN_DURATION - Default: 300s
  • Connection pool limiting via MAX_CONNS_PER_HOST - Default: 1024
  • TLS verification control via CLIENT_DISABLE_TLS_VERIFY
  • Improved buffer handling and response processing

Testing & Quality Improvements

Expanded test coverage including:

  • Extensive test coverage for all new features
  • Integration tests for end-to-end validation
  • Dedicated test suites for:
    • Circuit breaker functionality
    • Circuit breaker state transitions
    • Circuit breaker fallback behavior
    • FastHTTP client behavior
    • Memory cache compression
    • Memory cache eviction
    • Gzip error handling

Architectural Impact

These changes significantly improve the proxy's:

  • Resilience to backend failures through circuit breaking
  • Resource utilization through memory-aware caching
  • Performance under load with optimized HTTP and GraphQL handling
  • Prevention of cascading failures
  • Protection against resource exhaustion

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.

1 participant