--- title: Serverless description: "Run code without managing servers: event-driven, auto-scaling, pay per use. Cold starts and execution limits apply." canonical: https://penasihathosting.com/en/hosting-wiki/serverless type: wiki locale: en updated: 2026-10-29 author: Willya Randika --- # Serverless ## Overview - **Summary:** Run code without managing servers: event-driven, auto-scaling, pay per use. Cold starts and execution limits apply. - **Author:** Willya Randika ([profile](/penulis/willya-randika)) ## Article **Serverless** is a model for running code without directly managing servers. You write a function, the provider runs it when an event occurs, and billing follows usage. Examples include AWS Lambda, Cloudflare Workers, and Vercel Functions. ## How it works 1. An event arrives — an HTTP request, file upload, queue message, or schedule. 2. The platform starts a runtime and runs the function. 3. The function finishes and the runtime stops. 4. You pay for execution time and resources used. ## Strengths and limits | Aspect | Serverless | VPS | | --- | --- | --- | | Scaling | Automatic | Manual/configured | | Cost | Per use | Per month | | Cold start | Possible | No | | Execution limit | Usually seconds–minutes | As long as the server runs | | OS control | Limited | Full | ## When it fits Serverless fits small APIs, webhooks, image processing, light cron jobs, and uneven load. It is a poor fit for long-running processes, applications needing a persistent filesystem, or services that require an always-open database connection. ## What to watch for - **Cold starts.** A rarely called function can be slow on the first request. - **Time and memory limits.** Good for short tasks, poor for long processes. - **Egress and requests.** Costs can rise with heavy traffic. - **Vendor lock-in.** APIs and runtimes differ between providers. - **It is not a database replacement.** Data still needs a separate service. Serverless functions often open a new database connection per invocation. Without a pooler, the database can run out of connections under load. Use a pooler, cap concurrency, or choose a database with an HTTP API. A minimal Node.js handler: ```js export const handler = async (event) => { return { statusCode: 200, body: JSON.stringify({ ok: true }) }; }; ``` On AWS Lambda, cold start appears in the `Init Duration` metric in CloudWatch; on Cloudflare Workers, check execution time in the dashboard. Measure before choosing a provider, because documentation numbers are not your workload. ## FAQ No. Servers still exist, but the provider manages them. You do not handle the OS, patching, or machine capacity. It can be cheaper for small or uneven workloads. For stable, high load, a VPS is often more economical. Usually not for a full WordPress site. WordPress needs a filesystem, persistent PHP, and a database that fits regular hosting or a VPS better.