Skip to content

Version 2.0.0

Choose a tag to compare

@eswar-7116 eswar-7116 released this 11 Apr 18:26
· 60 commits to main since this release
v2.0.0
9fd0a29

glambdar version 2.0.0

Notable Changes

Features

  • EWMA-Based Predictive Pre-Warming: Added a traffic-aware container pre-warmer that uses Exponentially Weighted Moving Average (EWMA) with dynamic alpha to predict demand and proactively spin up idle containers, eliminating cold starts under burst loads.
  • Traffic Prediction Engine: New internal/ewma package with a TrafficPredictor that dynamically adjusts its smoothing factor based on traffic deviation for responsive scaling.
  • Per-Pool Invoke Tracking: Each container pool now tracks invocation counts via an atomic counter, feeding the EWMA predictor every 30 seconds.
  • Multi-Method Support: Functions now support GET, POST, PUT, PATCH, and DELETE methods for invocations. The request method is passed to the function handler via req.method.
  • Automatic Pool Cleanup: Warm container pools are now immediately drained and containers are stopped when a function is deleted.
  • Concurrent Request Handling: A single container instance can now handle multiple concurrent requests (up to a configurable limit), improving resource utilization and drastically reducing cold starts by 42%.
  • Smart Pooling Logic: Updated the pool manager to keep containers in the "Idle" pool until they reach their concurrency threshold, allowing for better "saturation" routing.
  • Per-Function Rate Limiting: Added support for setting a maximum requests per second limit during function deployment.
  • Dynamic Configuration: New POST /config/:name endpoint allowing real-time updates to function rate limits without redeploying.
  • Intelligent Burst Scaling: Implemented a burst logic that scales at 10% of the rate limit to provide better throughput management.
  • Monitoring Improvements: Added ColdStart field to invocation responses to track and benchmark container creation events.
  • Add Benchmarking Scripts: Added benchmarking scripts used to analyze the engine's performance.
  • Persistent Workers: Transitioned to persistent Unix Domain Socket (UDS) servers for workers, significantly improving invocation performance.
  • Auto-Scaling & Latency: Achieved a 99.6% reduction in latency through auto-scaling container pools and persistent UDS workers.
  • Log Management: Functions now support log extraction and storage in a centralized SQLite database.
  • Container Pooling: Implemented per-function container pooling for optimized resource reuse.
  • Cron Jobs: Integrated cron jobs to automatically remove stale containers.
  • Docker Integration: Added automatic image pulling and Docker reachability guards.
  • Storage Migration: Migrated metadata storage from JSON files to a centralized SQLite database to prevent race conditions.
  • Directory Structure: Simplified storage by using a .glambdar directory for worker scripts and deployed functions.

Refactoring & Improvements

  • Benchmarking Suite Rewrite: Replaced the monolithic benchmark_cli.go with a modular benchmarking suite (benchmark.go, client.go, main.go, types.go) for clearer separation of concerns.
  • Shared Socket Utility: Extracted waitForSocket into a standalone internal/sockutil package to allow reuse by both the invoke path and the pre-warmer without import cycles.
  • GetOrCreate Error Handling: PoolManager.GetOrCreate now returns an error, enabling graceful handling of predictor initialization failures.
  • Docker SDK Migration: Transitioned from using Docker CLI via exec.Command to the official Docker SDK for more robust container management.
  • Centralized configuration management in internal/config.
  • Reorganized project structure by moving the entry point to the root.
  • Added comprehensive unit tests for logging functionality.
  • Exported BaseDir path for better internal visibility.

Documentation & Tests

  • Updated README with latest benchmark results and design choices referencing IEEE methodologies.
  • Updated README with new API documentation and latest benchmark results.
  • Added comprehensive unit and integration tests for rate limiting and configuration management.
  • CI/CD: Added integration test steps to the GitHub Actions workflow to ensure multi-method and pool management stability.

Bug Fixes

  • Resource Management: Fixed a temporary file leak in the deployment process where zip files were not cleaned up from /tmp.
  • Handler Robustness: Improved the standard test function to handle null headers and gracefully echo request metadata.
  • API Reliability: Corrected response status handling and updated internal versioning variables.
  • Fixed several race conditions in the container pool acquisition logic.
  • Ensured MaxConcurrency settings are safely handled as int32.
  • Fixed Docker client lifecycle management to ensure closure after server shutdown.
  • Ensured functions/ directory is created if it does not exist.
  • Improved error messaging across the system.
  • Added .gitignore patterns for build outputs.

Performance Gains

  • Cold Start Latency: Reduced to ~230 ms (from ~590 ms).
  • Warm Start Latency: Improved to ~1.06 ms (from ~1.3 ms).
  • Warm Throughput: Increased to ~2,951 req/s (from ~1,100 req/s).
  • Burst Cold Starts: Reduced to zero across consecutive burst rounds thanks to predictive pre-warming.

Full Changelog: v1.0.0...v2.0.0