logo
Parslinks
Back to blog
Platform5 min read

Serverless, containers or PaaS? Three runtime models with one real application

All three work. The question is which one fits the shape of your traffic and your team's patience.

Ehsan Yaghmori

Founder & CTO, Parslinks

A four-person team is building the API for a sporting-goods shop: orders, SMS confirmations, a payment gateway, and a sales report built every night at midnight. In the architecture meeting, one person says "let's go serverless, we only pay for what we use", another says "containers and Kubernetes, it's the industry standard", and a third asks "why not put what has always worked onto a platform?"

All three are right. They're just talking about three different problems.

Three models in one sentence each

  • Serverless (functions as a service): you ship code as functions; each request runs one, then it shuts down. You pay for execution time.
  • Containers on your own servers: you package the app as an image and run it on servers you maintain, with Docker Compose or an orchestrator.
  • PaaS: the same containers, but servers, networking, SSL and deploys belong to the platform. You bring code and settings.

Compared for this API

Serverless, self-managed containers and PaaS compared for a shop API

Where serverless shines

Short, sporadic, stateless work: resizing an image after upload, answering a webhook, a contact form filled in ten times a day. Zero traffic means zero cost, and sudden spikes are absorbed without planning.

Where serverless hurts

For our shop API it has three serious problems:

Cold starts. The first request after idle time waits for the function to boot, sometimes one to several seconds. For a user who just pressed pay, that's long.

Database connections. Every function instance opens its own connection. With a hundred concurrent requests you have a hundred connections to PostgreSQL and the database hits its limit. There's a fix (a separate pooler), but it's one more piece to run.

Long jobs. An eight-minute nightly report exceeds most serverless execution limits and has to be broken up.

And a local note: the big global serverless providers are also hard to pay for from Iran and carry sanctions risk.

Containers on your own servers

Full control and low cost for steady load. But Docker Compose on a server means all the VPS responsibilities (patches, SSL, backups, monitoring) plus managing images. Add Kubernetes and you add a whole extra layer. We cover that decision in do you need Kubernetes.

PaaS

Always-on processes, persistent database connections, long jobs and queues, no cold starts, and server upkeep handled by the platform. The cost: under very large, steady load it's pricier than raw servers, and you don't get low-level control.

WorkloadSuggested model
API and website with normal daily trafficPaaS
Short, sporadic jobs (webhooks, image resizing)Serverless, or a small process on PaaS
Queue workers and scheduled jobsPaaS or containers
Heavy, steady load with an infra teamContainers on your own servers
Experimental project with near-zero trafficServerless, or PaaS on a small plan

What the shop team chose

The team put the API, the SMS worker and the nightly report on a PaaS: three processes from one repo, with one deploy method and one place for logs. Product-image resizing went to a small separate process. Next year, if traffic grows tenfold and they hire a full-time infrastructure engineer, they'll run the numbers again. Architecture decisions have expiry dates too.

Frequently asked questions

Join the discussion

No comments yet. Be the first to share your thoughts.