A job that generates invoice PDFs overnight, an order endpoint that gets loaded twice a year on campaign day, a small service that receives a webhook: renting a full-time server for any of these is often money wasted. Serverless architecture is a way to write code as small functions that run only when they are called, and to pay only for what you use. The name is misleading, though: servers do not disappear, their management simply passes to the provider. And it is not cheap or right for every job.
In this guide we explain what serverless architecture is, how it works, how cold starts affect latency, what the time, memory and concurrency limits are, what a concurrency cap does at peak load, the break-even between pay-per-use and a fixed server, provider dependency, and when serverless is not suitable. All figures are illustrative; they are not any provider's price or an industry average.
What Is Serverless Architecture?
Serverless architecture is an approach in which part of an application runs in an environment operated by a provider, as short-lived functions that execute when an event arrives. The operating system, patching, scaling and capacity planning sit with the provider; you define only the function's code, its trigger and its limits. The bill comes from the number of calls multiplied by run time and memory; with no calls, the cost is close to zero.
This model is also called functions as a service. The trigger can be a network request, a message landing in a queue, a timer or a file upload. If you are used to thinking in events, our event-driven architecture guide gives the underlying logic; a serverless function is one way to receive those events.
We recommend reading: Our custom software service
What Is the Difference Between a Serverless Function and an Always-On Server?
An always-on server is running all the time, can hold state in memory and has exactly the capacity you chose. A serverless function runs in a short-lived environment, newly created or reused, on every call. The differences are these.
| Topic | Always-on server | Serverless function |
|---|---|---|
| Billing | Fixed; whether used or not | Per call and per run time; near zero when idle |
| Scaling | You plan the capacity | The provider, automatically up to a limit |
| State | Can be held in memory | Not reliable between calls; needs an external store |
| First-request latency | Consistent | Can be high on a cold start |
| Run time | Unlimited | Has a ceiling; long jobs are split |
| Operations effort | Patching, monitoring, capacity | Less; but monitoring and limit management stay with you |
| Dependency | Low; portable | Triggers and identity layer are provider-specific |
For concepts of scaling and latency see our software scalability guide, and for the general choice between cloud and local servers see our cloud versus on-premise guide; serverless is one operating style inside the cloud option.
How Does Serverless Architecture Work?
Knowing the life of a single call makes both latency and cost easier to understand.
- Trigger: An event arrives; for example a request to an order endpoint or a message in a queue.
- Environment readiness: If a ready, idle environment exists it is used; if not, a new one is created (a cold start).
- The function runs: The work is done in a short time and the result is written.
- The environment waits: For consecutive calls the environment is kept alive briefly, then shut down.
- Billing: The number of calls and the product of run time and memory are measured.
You cannot rely on anything the function keeps in memory, because the next call may run in another environment. That is why carts, sessions and counters are stored in the database or in an external cache of the kind described in our caching guide.
How Does a Cold Start Affect Latency?
A cold start is the extra time needed to create a new environment when no ready one exists. Most calls run in a warm environment and a few start cold. The average hides this difference; percentiles show it.
Illustrative example: a warm call takes 120 ms and a cold call 120 + 900 = 1,020 ms. If 3% of calls start cold, the average is 0.97 × 120 + 0.03 × 1,020 = 116.4 + 30.6 = 147.0 ms, and p95 is still 120 ms because the cold share is below 5%. If the cold share rises to 6%, the average becomes 0.94 × 120 + 0.06 × 1,020 = 112.8 + 61.2 = 174.0 ms (about +18.4%), but p95 jumps to 1,020 ms, 8.5 times 120 ms.
| Cold share | Average | p95 | p99 |
|---|---|---|---|
| 0.5% (pre-warmed) | 124.5 ms | 120 ms | 120 ms |
| 3% | 147.0 ms | 120 ms | 1,020 ms |
| 6% | 174.0 ms | 1,020 ms | 1,020 ms |
Ways to reduce it: keep environments prepared in advance (a reserved warm instance; illustratively, two instances cost ₺900 a month), keep the package small, avoid heavy work at start-up, and move work off the path the user is waiting on into the background.
What Are the Time, Memory and Concurrency Limits of Serverless?
Every provider sets a maximum run time per function, a memory range and a concurrency quota per account. The values differ by provider; the figures below are illustrative, and you should read your real quota from the provider's documentation.
Time limit and splitting the job
Say the maximum run time is 15 minutes (900 s). A batch job of 10,000 rows at 120 ms per row takes 10,000 × 0.12 = 1,200 s, or 20 minutes, and exceeds the limit. Split into five parts of 2,000 rows, each part takes 240 s (4 min), which is 26.7% of the limit and leaves room for errors and retries. The logic of chunked batch work is the same as in our message queue guide.
Memory and cost
Cost is measured as memory (GB) × time (s). A function using 0.5 GB for 0.2 s consumes 0.1 GB-s. If memory goes up to 1 GB and, because processing power scales with memory, the run drops to 0.1 s, consumption is again 1 × 0.1 = 0.1 GB-s; more memory is not always more expensive (this holds only for CPU-bound work).
Concurrency limit
The number of environments running at once is requests per second times duration. At a normal load of 250 requests/s and 0.2 s per call you need 250 × 0.2 = 50 concurrent environments. If 900 requests/s arrive on campaign day you need 900 × 0.2 = 180; with a quota of 100, capacity is 100 ÷ 0.2 = 500 requests/s. The excess 400 requests/s is rejected or waits.
If the peak lasts 60 s, 400 × 60 = 24,000 requests can be queued. After the peak the spare capacity is 500 − 250 = 250 requests/s, so the backlog clears in 24,000 ÷ 250 = 96 s. Another trap is the database: if 180 function environments each hold a connection and the connection pool is 100, it overflows; you need an intermediate layer that limits connections, or a per-function concurrency cap.
Is Serverless or a Fixed Server Cheaper? The Break-Even Calculation
Pay-per-use is very cheap at low volume and expensive at high, steady volume. Do the calculation with a unit cost per call. Illustrative assumptions: the function uses 0.5 GB and 0.2 s; the memory-time price is ₺0.0006 per GB-s; the request fee is ₺0.00002; the gateway fee is ₺0.00003. The fixed alternative is two servers at ₺6,000 a month.
| Item | Calculation | Per call |
|---|---|---|
| Compute (memory × time) | 0.5 × 0.2 = 0.1 GB-s × ₺0.0006 | ₺0.00006 |
| Request fee | — | ₺0.00002 |
| Gateway | — | ₺0.00003 |
| Total | — | ₺0.00011 (₺110 per million calls) |
| Calls per month | Serverless | Fixed server | Difference |
|---|---|---|---|
| 3 million | ₺330 | ₺6,000 | Serverless 94.5% cheaper |
| 20 million | ₺2,200 | ₺6,000 | Serverless 63.3% cheaper |
| 54.5 million | ≈ ₺6,000 | ₺6,000 | Break-even |
| 100 million | ₺11,000 | ₺6,000 | Serverless 83.3% more expensive |
Break-even: ₺6,000 ÷ ₺110 = 54.5 million calls. A month has 2,592,000 seconds (30 days), so this is on average 54,545,000 ÷ 2,592,000 ≈ 21 calls/s. To make the comparison fair, include operations effort: if patching and monitoring on the fixed server take 10 hours a month × ₺300 = ₺3,000, the fixed side becomes ₺9,000 and the break-even rises to 9,000 ÷ 110 = 81.8 million calls (≈ 31.6 calls/s). Serverless has its own monitoring and limit-management effort, so measure both before concluding. If load is spiky the average misleads: a fixed server is sized for the peak, so a spiky load whose average is above break-even can still be cheaper on serverless. We looked at cloud spending in general in our cloud cost management guide.
Why Do Statelessness and Duplicate Protection Matter in Serverless?
Because functions are short-lived, three rules are needed.
- Statelessness: Everything that must travel from call to call lives in the database, a cache or the request itself. Code that trusts a variable in memory will quietly misbehave in another environment.
- Duplicate protection: Queue and timer triggers mostly run "at least once". The same message can arrive twice; the function must not process the same event identifier a second time. This rule is essential for functions that receive webhooks; the details are in our webhook guide.
- Short, fast replies: Handing a long job to a queue and returning a quick 2xx prevents timeouts and retry storms.
How Much Provider Dependency Does Serverless Create?
Business logic is usually portable; the glue layer is not. Triggers, identity, queue connections and the deployment definition are provider-specific. Illustrative example: 40 functions, each written in 2 person-days (80 person-days). If the code is bound directly to the provider layer, 30% is rewritten on migration: 40 × 2 × 0.30 = 24 person-days = 24 × ₺9,000 = ₺216,000. If you put the business logic behind a thin adapter layer, that share falls to 10%: 8 person-days = ₺72,000. The difference is ₺144,000 (a 66.7% reduction).
Full portability does not exist in practice; the goal is to know the cost of leaving and to limit it. For the cost of splitting a system and service boundaries see our microservices architecture guide; serverless is easily confused with microservices but is a different thing: one is a run model, the other a way of dividing.
When Is Serverless Architecture Not Suitable?
- Steady, high load: On a flat load far above break-even, a fixed server is cheaper.
- Long-running jobs: Jobs that exceed the time limit do not run without splitting.
- Strict low latency: If cold starts are unacceptable, the cost of warming erodes the advantage.
- Jobs that need state in memory: Session-based work, work relying on a local cache or on persistent connections.
- Unpredictable bill risk: If a faulty loop or an attack multiplies the calls, the bill multiplies too; a spending cap and alerts are essential.
Serverless or Not? A Six-Question Decision Test
Answer for the candidate job. Each "yes" is one point in favour of serverless.
- Is the job event-triggered, and is the load uneven or intermittent?
- Is a single run shorter than half the time limit?
- Can state be kept outside, and can the job be written statelessly?
- Is the average call rate below break-even (or is the load highly spiky)?
- Is an occasional cold start of several hundred milliseconds acceptable?
- Is there a written exit plan and cost for provider dependency?
| Number of "yes" | Meaning | Suggested step |
|---|---|---|
| 5–6 | Strong serverless candidate | Run a pilot with one job |
| 4 | Suitable, watch the risks | Run a pilot, measure cold starts and quotas |
| 2–3 | Mixed picture | Cost both run models |
| 0–1 | Fixed server candidate | Stay with the current model, improve if needed |
Before turning the score into a decision, write down the job's requirements; we explained how in our requirements analysis guide.
How Is a Move to Serverless Carried Out?
Do not move the whole system in one step; start with small jobs that have clear limits.
- Pick jobs: Event-driven, short, stateless work; for example PDF generation, notifications, scheduled reports.
- Measure load: Calls per second, duration, memory and peak hours.
- Write limits: Set the time, memory and concurrency quotas and a spending alert.
- Run a pilot: Run one job under real load; measure the cold-start share and p95.
- Add a queue: Smooth the peak with a queue and put duplicate protection in place.
- Watch and decide: Monitor cost and latency; write the exit plan, then expand.
The payback calculation
Illustrative example: three jobs (invoice PDF, notification, nightly report) run today on two dedicated servers at ₺6,000 a month. The monthly load is 12 million calls; on serverless that is 12 × ₺110 = ₺1,320. If server effort falls from 10 hours to 4, 6 × ₺300 = ₺1,800 is saved. Monthly gain: (₺6,000 − ₺1,320) + ₺1,800 = ₺6,480. The move costs 20 person-days × ₺9,000 = ₺180,000. Payback is 180,000 ÷ 6,480 ≈ 27.8 months. If the gain halves (₺3,240), it stretches to ≈ 55.6 months. Serverless does not always pay for itself quickly.
What Are Common Mistakes in Serverless?
- Splitting everything into functions: Very small pieces raise the management load and the latency.
- Looking at the average: Without p95 and p99 the cold start stays invisible.
- Processing a queue without duplicate protection: The same order is processed twice.
- Setting no spending alert: A faulty loop multiplies the bill.
We recommend reading: What is event-driven architecture?
We recommend reading: How to manage cloud costs (FinOps)
Custom Software and Integration with İnovabil
At İnovabil our focus is building bespoke software from scratch for a given company: custom software, ERP, CRM, e-commerce, web, mobile and integration. We do not claim to have a serverless product or a serverless architecture reference; this article is a decision guide. We suggest comparing the run model (fixed server, cloud, short-lived functions) in the requirements analysis according to the load profile, in writing, with its costs and limits.
We have built CRM, purchasing and mobile for Avcılar İnşaat; a purchasing system for İZBAN; logistics and shipment planning with wholesale order management for Karyak; and warehouse management plus a complaint and support management system for Sleepy. Send us a short summary of your load and jobs and we will produce a written assessment together.
We recommend reading: Our software development process: from analysis to launch, step by step
Frequently Asked Questions
What is serverless architecture?
It is an architecture in which code runs as short-lived functions in the provider's environment when an event arrives, and is paid for per call and run time. Servers exist, but the provider manages them.
Is serverless architecture always cheaper?
No. In the example, at 3 million calls a month serverless costs ₺330 against ₺6,000 for a fixed server; but break-even is about 54.5 million calls and at 100 million serverless rises to ₺11,000. Calculate with your own prices and load.
What is a cold start and how is it reduced?
It is the extra time needed to create a new environment when no ready one exists. A reserved warm instance, a small package and avoiding heavy work at start-up reduce it. Look at p95 and p99, not the average.
Is serverless the same as microservices?
No. Microservices is a way of dividing an application into independent services; serverless is a run model. A microservice can run as a serverless function or on an always-on server.
Which jobs is serverless not suitable for?
Steady and high load, long jobs that exceed the time limit, strict low latency, work that needs state in memory and systems where provider independence is a must. Test the candidate with the six-question test first.