Repository navigation
Version 2.0.0
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/ewmapackage with aTrafficPredictorthat 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, andDELETEmethods for invocations. The request method is passed to the function handler viareq.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/:nameendpoint 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
ColdStartfield 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
.glambdardirectory for worker scripts and deployed functions.
Refactoring & Improvements
- Benchmarking Suite Rewrite: Replaced the monolithic
benchmark_cli.gowith a modular benchmarking suite (benchmark.go,client.go,main.go,types.go) for clearer separation of concerns. - Shared Socket Utility: Extracted
waitForSocketinto a standaloneinternal/sockutilpackage to allow reuse by both the invoke path and the pre-warmer without import cycles. GetOrCreateError Handling:PoolManager.GetOrCreatenow returns an error, enabling graceful handling of predictor initialization failures.- Docker SDK Migration: Transitioned from using Docker CLI via
exec.Commandto 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
BaseDirpath 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
MaxConcurrencysettings are safely handled asint32. - 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
.gitignorepatterns 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