Skip to main content

What are you looking for?

Explore our services and discover how we can help you achieve your goals

Client Workspace

Serverless or Containers: Choosing the Compute Model per Workload

Choose the compute model per workload, not per company: functions suit bursty, short, event-driven work, serverless containers suit web services that idle, and always-on containers suit steady, long-running or connection-heavy work. Netbase decides it with the workload-shape table below, checking cold starts, platform limits and cost curves.

Book a solution review See the related solution

By Netbase Commerce and Platform Engineering Desk · Reviewed by David (CEO) · Updated · 11 min read

star

This guide is for CTOs, tech leads and product owners deciding how a new or migrated product should run. It sits under Netbase's cloud platform engineering work, where the compute model is part of the platform design, and the release side belongs to DevOps and platform engineering.

In this guide

What is the real difference between serverless and containers?

Both run your code without you managing servers by hand. The difference is who decides when capacity exists and what you pay for. A serverless function runs per request or event, scales to zero and bills per call and run time. A container runs a whole server process that you size, keep running and pay for while it is up.

Between them sits the serverless container: you ship an image, and the platform scales it with traffic, down to zero if you allow it. So the useful question is no longer "serverless or containers?" but "which shape does this workload have?"

Serverless functions, serverless containers or always-on containers?

Criterion Serverless functions Serverless containers Always-on containers
Unit you deploy A function handler, as a package or image A container image that serves HTTP A container image you size and keep running
Scaling Per request or event, to zero Per request, to zero or to a minimum By rules you set, never to zero by default
Requests per instance One at a time per environment Many at once, set per service Many at once, limited by your process
Longest single run Platform cap per invocation Platform cap per request No platform cap
What you pay for Requests and run time Instance time, at a lower rate when idle on some plans Reserved vCPU and memory while running
Choose it when Work is short, spiky or event-driven A web service is idle much of the day Load is steady, long or holds connections

The limits are concrete. AWS Lambda caps one invocation at 15 minutes and memory at 10,240 MB, allows a 250 MB unzipped package or a 10 GB container image, and limits a synchronous request and response to 6 MB each. Cloud Run sets a 5-minute request timeout by default, configurable up to 60 minutes, and lets one instance serve up to 1,000 concurrent requests.

Which compute model fits which workload shape?

Most products are several workloads: an order system has an API, a nightly export, an e-mail queue and perhaps a live dashboard. Map each one separately:

  • Bursty public API, idle at night

    Starting model
    Serverless container or function
    The limit that decides it
    Cold start on the first request after idle
  • Steady API under constant load

    Starting model
    Always-on container
    The limit that decides it
    Per-request billing outgrows reserved capacity
  • Scheduled job under a few minutes

    Starting model
    Function
    The limit that decides it
    None, if it fits the run-time cap
  • Queue or event consumer

    Starting model
    Function
    The limit that decides it
    Downstream database connections
  • Long batch, migration or report build

    Starting model
    Container job
    The limit that decides it
    Run-time cap per invocation or request
  • WebSocket, streaming or long-polling

    Starting model
    Always-on container
    The limit that decides it
    Connection length and per-request timeouts
  • Heavy dependency, large model or GPU

    Starting model
    Container
    The limit that decides it
    Package size, memory cap and start time

Treat each row as a starting point and confirm it with the five checks below. A workload that changes shape moves rows, and its compute model should move with it.

When do cold starts actually matter?

A cold start is the time a platform needs to prepare a new environment before your code runs. AWS describes it as downloading the code, starting the environment and running initialisation code, and notes that it typically occurs in under 1% of invocations and lasts from under 100 ms to over 1 second. The initialisation phase is billed and adds latency.

Cold starts matter when a person waits on the response and traffic is thin, because the first visitor after an idle period pays the delay. They rarely matter for a queue consumer, a scheduled job or a webhook handler that retries.

You can buy cold starts away, but the bill changes shape. AWS Lambda provisioned concurrency keeps environments initialised ahead of requests and is billed while it is configured; Cloud Run minimum instances keep containers warm, billed at a lower idle rate on request-based billing and at the full rate on instance-based billing. Either way, a function kept permanently warm starts to cost like a small always-on service.

How do the cost curves differ?

Each model has a different billing dimension, so their costs grow differently with traffic:

  • Functions: Lambda bills per request plus run time in GB-seconds, measured in 1-millisecond steps. Cost rises in a straight line with calls and is close to nothing at zero traffic.
  • Always-on containers: AWS Fargate bills vCPU, memory and storage per second with a 1-minute minimum while a task runs. Cost is flat for a given size, whether the container serves one request or thousands.
  • Serverless containers: cost follows instance time, which tracks traffic but rises in steps, because one instance absorbs many concurrent requests.

So there is a crossover. At low or spiky volume the per-request line sits below the flat line; as steady traffic grows the per-request line crosses it. Where it crosses depends on request duration, memory and concurrency, so calculate it with your own metrics instead of trusting a percentage from an article. Commitment discounts move the flat line down again, which is why our guide to savings plans and committed use says to settle the compute model before committing. To see the bill per customer or feature afterwards, use the attribution steps in cloud cost controls for SaaS.

Every model also carries costs outside the compute line: logs, NAT, data transfer and the time to operate the platform; our VPC design mistakes guide covers the network side.

How to choose the compute model for one workload

  1. Measure the idle share

    Read hourly request counts for a typical week; a workload idle most of the day leans serverless.

  2. Set the latency budget

    Write down whether a person waits on the response and how long a first request may take after idle.

  3. Find the longest run

    Compare the longest job or request, plus margin for growth, against the platform's per-invocation or per-request cap.

  4. Count connections and state

    Check database connections at peak, open sockets and anything kept in memory between requests.

  5. Check who operates it

    Decide who patches images, watches scaling and answers alerts, then pick the model that team can run, and record the decision with the date to review it.

Connections deserve the most care. Each function environment handles one request at a time, so a traffic spike can open as many database connections as there are environments. AWS positions RDS Proxy for exactly this: it pools and reuses connections and queues or throttles the surge instead of letting it overwhelm the database.

When should you not move a workload to functions?

Do not split a small product into dozens of functions to look modern. Each function adds a deployment, permissions, logs and alerts; for a team of a few engineers, one container that serves the whole API is easier to run and to debug.

Do not move a steady, busy API to functions to save money. Its traffic sits on the far side of the crossover, and keeping it warm to hide cold starts removes the remaining saving. Do not force long jobs under a run-time cap by chaining invocations unless you also add a state store and retries; a container job is simpler.

The reverse also holds: do not run an always-on container for a job that runs ten minutes a day, and do not build a Kubernetes cluster for a product whose workloads all fit a serverless container.

Where AI fits in choosing a compute model

AI helps gather the evidence, not make the call. An assistant can summarise request logs into an hourly traffic profile, list each workload's longest run and dependencies from the code and pipeline files, and draft the comparison for a review. Netbase works with the major commercial and open-source AI tools and models, chosen per project.

Engineers still check every limit against current provider documentation, run a load test before a switch and own the decision record; no model gets rights to change production scaling or capacity settings.

What delivery record exists, and what does not

Netbase names AWS, Google Cloud, DigitalOcean and Cloudflare as the cloud providers it uses. It also works as offshore development partner on a multi-tenant cloud ERP delivered as SaaS to small and mid-sized businesses for a US client, not named.

Delivery runs in a six-step lifecycle with weekly reviews and KPI dashboards, and most Netbase projects are delivered on fixed-price contracts. No published Netbase record compares serverless and container costs for a client, and no latency, cost or saving figure is given here.

Alternatives: who makes the compute decision?

Option Fits when Selection criterion
Your own team with this table Engineers already run production and read the bill Each workload has a written decision and a review date
A platform engineering partner A new product or a migration needs the platform designed The partner shows per-workload reasoning, not one default
A managed service partner Nobody in-house will operate the platform Scaling, patching and alerts are named in the scope

For a move from servers, the compute model is decided per application in a cloud migration and modernization plan. Provider fit is covered on our cloud and DevOps stack page, and ongoing operation by managed cloud services.

What are the limits of this guide?

  • It compares compute models, not container platforms; choosing between Kubernetes and a managed container service is a separate decision.
  • Provider limits and billing change; check the current documentation before you design around a number.

Plan the next step with a Netbase consultant

Frequently asked questions

No. Serverless is usually cheaper for spiky or mostly idle workloads, because you pay little when nothing runs. For steady, busy workloads, reserved container capacity usually costs less, and keeping functions warm to avoid cold starts narrows the gap further.

Yes, and most products should. A common split keeps the main API in a container, runs scheduled and queue work as functions and moves long batch jobs to container jobs.

A container that scales from zero also needs time to start, so serverless containers can show cold starts. Always-on containers avoid them for normal traffic, but new instances still take time to start when the platform scales out.

Next step

If you want each workload of your product placed on the right compute model before the bill decides for you, book a solution review with Netbase.

AI-ready cloud platform engineering for SaaS and commerce workloads AI-ready cloud platform engineering for SaaS and commerce workloads

Netbase provides cloud platform engineering for SaaS and commerce teams that need a secure, repeatable home for their software and its AI features, on AWS, Google Cloud, DigitalOcean or Cloudflare. We design the architecture, write the environments as code, connect managed and AI services and hand over a platform your team can run, built the way we run ours.

Learn More
line
AI-assisted cloud migration with a cut-over plan and a way back AI-assisted cloud migration with a cut-over plan and a way back

Netbase provides cloud migration services for companies running business applications on ageing servers or hosting to move them to AWS, Google Cloud, DigitalOcean or Cloudflare without losing data or control. AI speeds up the code and dependency assessment; every migration still has an inventory, a rehearsed cut-over, cost controls from day one and a tested rollback point.

Learn More
line
AI-assisted DevOps and platform engineering for routine releases AI-assisted DevOps and platform engineering for routine releases

Netbase provides DevOps and platform engineering for SaaS and commerce teams to make releases routine instead of risky. We set up CI/CD pipelines, repeatable environments and observability on AWS, Google Cloud, DigitalOcean or Cloudflare, with AI assistance for tests, reviews and incident triage, so every change ships the same way and problems surface before customers notice.

Learn More
line
SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules

A SaaS product accelerator is a set of reusable Netbase modules for accounts, billing, roles and integrations that helps founders and product teams launch subscription software faster, with room for in-product AI from the first release. Reusing these modules can shorten development time, and the approach is proven on Printcart, Netbase's own web-to-print SaaS.

Learn More
line

Work with Netbase remotely

Every Netbase engagement is delivered remotely, so clients in any country and any industry can work with us; Netbase has worked with clients in 80 countries. Contracts and invoices are issued by Netbase JSC, and payment is made by bank transfer to Netbase JSC's company account or PayPal Business. Talk to the CEO, Huy Nguyen (David), on WhatsApp or by email.

Contact Netbase

Discuss a project

Netbase JSC helps organizations design, build, modernize, and operate digital products and AI-enabled business systems.
Project enquiries

project@netbasejsc.com

WhatsApp

+84 937 869 689

Office address

91 Nguyen Chi Thanh, Dong Da, Hanoi, Vietnam

Get in touch

Tell us what you want to build, modernize, or operate.

Tell us what you want to build, modernize, or operate.

Contact Netbase