Overview

HAPIC is a peer-reviewed research paper that presents a hybrid caching strategy to significantly reduce cold-start latency in AWS Lambda environments. This work was accepted to IEEE SmartCloud 2026 as first author, with an extended version under review for IEEE IC2E 2026.

Problem Statement

AWS Lambda cold-starts cause significant latency spikes (200-500ms) when functions haven’t been invoked recently. This severely impacts user experience in production systems and makes serverless less viable for latency-sensitive applications.

Solution & Approach

HAPIC combines three complementary strategies:

  1. Predictive warming - ML-based prediction of usage peaks to pre-initialize containers
  2. Adaptive caching - Dynamic cache strategy adjustment based on real-time CloudWatch metrics
  3. Multi-tier optimization - Coordinated optimization across Lambda, API Gateway, and networking layers

Key Features & Achievements

  • ✅ 20-40% latency reduction in cold-start scenarios
  • ✅ Consistent performance across varying concurrency levels (10-1000 concurrent requests)
  • ✅ Minimal overhead on warm-start performance (<5% impact)
  • ✅ Cross-runtime validation - tested on Node.js, Python, and Java runtimes
  • ✅ Peer-reviewed publication - accepted to top-tier IEEE conference

Code Snippets

Lambda Pre-initialization & Caching (Python):

import json
import time
from functools import lru_cache
import boto3

# Container initialization (runs once)
cloudwatch = boto3.client('cloudwatch')
s3 = boto3.client('s3')

# Pre-warm critical resources
@lru_cache(maxsize=1000)
def get_model_from_cache(model_key):
    """Cached model loading to reduce cold-start impact"""
    start = time.time()
    try:
        # Try fast S3 cache first
        response = s3.get_object(Bucket='model-cache', Key=model_key)
        model = json.loads(response['Body'].read())
        cache_hit = True
    except:
        # Fall back to downloading
        model = download_model(model_key)
        cache_hit = False
    
    latency = (time.time() - start) * 1000  # ms
    cloudwatch.put_metric_data(
        Namespace='HAPIC',
        MetricData=[{
            'MetricName': 'CacheLatency',
            'Value': latency,
            'Unit': 'Milliseconds',
            'Dimensions': [{'Name': 'CacheHit', 'Value': str(cache_hit)}]
        }]
    )
    
    return model

def lambda_handler(event, context):
    """Actual Lambda handler"""
    model = get_model_from_cache('default_model')
    # Process event...
    return response

Benchmarking with k6 Load Testing (JavaScript):

import http from 'k6/http';
import { check } from 'k6';

export let options = {
    stages: [
        { duration: '5m', target: 10 },   // Warm up
        { duration: '5m', target: 50 },   // Ramp up
        { duration: '10m', target: 100 }, // Sustained
        { duration: '2m', target: 0 },    // Ramp down
    ],
};

export default function () {
    let response = http.get(
        'https://api.example.com/lambda-endpoint',
        { headers: { 'X-Test': 'cold-start' } }
    );
    
    check(response, {
        'status is 200': (r) => r.status === 200,
        'latency < 200ms': (r) => r.timings.duration < 200,
        'p95 latency < 500ms': (r) => r.timings.duration < 500,
    });
}
// Generates detailed performance metrics for analysis

Technologies Used

Languages: Python, JavaScript, Bash
Cloud Platforms: AWS Lambda, API Gateway, CloudWatch, S3
Testing & Benchmarking: k6 load-testing framework, steady-state & bursty workloads
Analysis Tools: Python, Pandas, Matplotlib, Seaborn
Metrics & Monitoring: CloudWatch Insights, Lambda Insights, Custom monitoring

Impact & Metrics

  • Latency Reduction: 20-40% decrease in cold-start latency across all configurations
  • Performance Stability: Reduced variance in response times under bursty workloads
  • Scalability: Solution maintains effectiveness at 100-1000x scale
  • Industry Impact: Contributes solution to one of serverless computing’s biggest challenges

What I Learned

  • Deep understanding of AWS Lambda architecture and cold-start mechanics
  • Performance benchmarking methodology for serverless applications
  • Hybrid systems design combining multiple optimization strategies
  • Research publication process and peer review
  • How to validate performance improvements across diverse runtime environments

Research Advisor: Prof. Ming-Hwa Wang (Santa Clara University)
Publication Status: Published in IEEE SmartCloud 2026
Extended Version: Under review for IEEE IC2E 2026
Duration: 6 months (Jan 2025 - Present)
GitHub: https://github.com/KarinaNi/hapic-serverless-research
Paper: [Link to be added]