What is Serverless Computing?
Serverless computing is a cloud execution model where you write and deploy individual functions or small services, and the cloud provider (or platform) manages all the underlying servers, scaling, and infrastructure. You pay only for the compute time your code actually uses — there is no concept of an "always-on" server to provision and maintain.
The term "serverless" is a bit misleading — there are absolutely servers running your code. What is serverless from your perspective is the responsibility of managing, patching, and scaling those servers. The operational burden disappears.
How Serverless Works
- 1You write a function — a single-purpose piece of code that responds to an event
- 2You deploy it to a serverless platform
- 3An event occurs — an HTTP request, a queue message, a scheduled timer, a file upload
- 4The platform instantiates your function (possibly from zero) and runs it
- 5The function executes and returns a response
- 6The platform scales automatically: zero invocations = zero cost, 10,000 concurrent invocations = automatic horizontal scaling
Serverless vs Traditional Servers vs Containers
| Traditional Server | Containers (PaaS) | Serverless | |
|---|---|---|---|
| Unit of deployment | Application | Container image | Function |
| Scaling | Manual or VM autoscaling | Container replicas | Automatic to zero |
| Idle cost | Always paying | Always paying | Zero idle cost |
| Cold start | None | Minimal | Possible delay |
| Max execution time | Unlimited | Unlimited | Usually limited (seconds to minutes) |
| Best for | Long-running services | Web apps, APIs | Event-driven, sporadic workloads |
When to Use Serverless
Serverless is a strong fit for:
- Webhooks and event handlers — GitHub webhooks, Stripe payment notifications, form submissions
- Scheduled jobs — Run a data processing function every hour without a full server
- Image or file processing — Trigger a function when a file is uploaded, process it, and store the result
- API endpoints with spiky traffic — A function that is called 0 times per day most days and 10,000 times during a product launch
- Glue code — Small functions that connect services together
Serverless is less ideal for long-running jobs (database migrations, video encoding), stateful workflows, or workloads where cold start latency is unacceptable.
Edge Functions: Serverless at the Network Edge
A specialized form of serverless runs not in a centralized data center but at edge nodes geographically distributed close to users. Edge functions execute with very low latency because the code runs in the region nearest to the user making the request.
Common edge function use cases:
- A/B testing and feature flags evaluated before the response is served
- Geo-based redirects or content personalization
- Authentication token validation at the edge
- Response transformation and header injection
Serverless and Edge Functions on PandaStack
PandaStack provides edge functions powered by Apache OpenWhisk, supporting both Node.js and Python runtimes. This means you can deploy lightweight functions without managing any server infrastructure.
To deploy an edge function on PandaStack:
- 1Install the CLI:
`bash
npm install -g @pandastack/cli
panda login
`
- 1Write your function (Node.js example):
`javascript
// handler.js
function main(params) {
const name = params.name || 'World';
return { body: Hello, ${name}! };
}
module.exports.main = main;
`
- 1Deploy the function:
`bash
panda functions deploy --name hello-world --runtime nodejs --file handler.js
`
- 1Invoke it via HTTP — PandaStack provides a public URL for every deployed function with built-in authentication via function tokens.
You can also combine edge functions with other PandaStack services: trigger a function from a cronjob, connect it to a managed database, and monitor invocations from the dashboard.
Serverless Best Practices
- 1Keep functions small and single-purpose — One function, one responsibility
- 2Minimize cold starts — Avoid heavy imports; load dependencies lazily when possible
- 3Use environment variables for config — Never hardcode credentials in function code
- 4Design for idempotency — Functions may be retried on failure; make sure running twice has the same effect as running once
- 5Set timeouts explicitly — Know the maximum execution time your platform allows and design within it
- 6Monitor invocations and errors — Serverless makes it easy to forget about functions once deployed; use platform monitoring to catch failures
Conclusion
Serverless computing removes the last layer of infrastructure management — you do not provision, scale, or patch anything. You write code, deploy a function, and pay only for what you use. For event-driven workloads, webhooks, and sporadic compute tasks, this is often the simplest and most cost-effective architecture.
PandaStack's edge functions (Node.js and Python via OpenWhisk) let you deploy serverless logic alongside your Docker containers and managed databases, all within a single platform. Explore function deployment at [docs.pandastack.io](https://docs.pandastack.io).