Serverless Function Optimization Using Predictive AI Algorithms

Authors

  • Ayesha Bibi Independent Researcher University Town, Peshawar, Pakistan (PK) – 25120 Author

DOI:

https://doi.org/10.63345/dfbkdc18

Keywords:

Serverless Computing, Function Optimization, Predictive AI, Auto-Scaling, Latency Reduction

Abstract

Serverless computing—embodied by Function-as-a-Service (FaaS) offerings such as AWS Lambda, Google Cloud Functions, and Azure Functions—has revolutionized application development by abstracting away infrastructure provisioning and management. Developers simply supply discrete functions, and the provider handles scaling, availability, and billing. Despite its transformative advantages in agility and cost control, serverless faces two endemic challenges: cold‑start latency and dynamic resource misallocation. Cold starts occur when a function’s container must be initialized before processing the first request, introducing delays that can exceed several hundred milliseconds. Unpredictable load patterns further exacerbate these issues, as static or reactive auto‑scaling policies lack the foresight and granularity to adjust resources optimally, leading either to overprovisioning (wasted cost) or underprovisioning (degraded performance). This study proposes a novel, end‑to‑end framework that synergistically combines predictive AI and reinforcement learning for proactive serverless function optimization. At its core is a two‑tier predictive architecture: a Long Short‑Term Memory (LSTM) network forecasts per‑minute invocation volumes using sliding‑window time‑series data; a Q‑learning agent then consumes these forecasts alongside real‑time performance metrics (current warm‑pool size, average cold‑start latency) to make fine‑grained provisioning actions—scaling the warm‑pool and adjusting memory allocation. To validate our approach, we implement a prototype on AWS Lambda, integrating Kinesis‑based log aggregation, DynamoDB for forecast persistence, and scheduled Lambdas for prediction and provisioning.

Under both synthetic Poisson workloads with periodic spikes and real‑world e‑commerce traffic traces, our hybrid solution demonstrably outperforms baseline strategies: it reduces average invocation latency by 38%, 95th‑percentile latency by 44%, and 99th‑percentile latency by 52%, while cutting overall provisioning cost by 21% compared to AWS’s native on‑demand scaling. An ablation study confirms that coupling forecasting with adaptive RL yields significant benefits over predictive heuristics or reactive RL alone. We discuss practical deployment considerations—including data collection overhead, training frequency, and exploration‑exploitation trade‑offs—and outline avenues for future research, such as continuous‑action RL, federated forecasting across tenants, and cross‐platform generalization. By proactively aligning resource allocation with anticipated demand, our framework advances serverless performance and cost efficiency without manual tuning, empowering developers to meet stringent latency and budgetary requirements in production environments.

Downloads

Download data is not yet available.

Downloads

Additional Files

Published

2025-02-07

Issue

Section

Original Research Articles

How to Cite

Serverless Function Optimization Using Predictive AI Algorithms. (2025). World Journal of Future Technologies in Computer Science and Engineering (WJFTCSE), 1(1), Feb (29-38). https://doi.org/10.63345/dfbkdc18