Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
FREEDOM251

Freedom251 › Blog › Background jobs

How to Run Long-Lived Background Jobs on Vercel with Always-On Workers

By Freedom251 Team · · 11 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a Vercel Daemon when a worker must remain continuously running. Use a normal Fluid Compute Function for work that fits within its invocation limit, waitUntil only for short follow-up tasks after an HTTP response, Workflow for durable multi-step jobs that must recover from crashes or deployments, and Queues when producers and consumers need buffering, retries, or fan-out. A function that simply keeps running is not an unlimited worker: it eventually reaches the maximum duration for its plan and times out.

Choose the Vercel primitive by the job’s failure and runtime requirements

Start with three questions: How long can one attempt run? Must the job survive a process failure or deployment? Do producers and consumers need to be decoupled? The answer determines the architecture more reliably than the framework or language.

As an Amazon Associate I earn from qualifying purchases.

Requirement Vercel primitive What it provides
The request finishes within five minutes on any plan Fluid Compute Function A bounded invocation with a 300-second default and Hobby maximum.
The request needs up to 800 seconds on Pro or Enterprise Function with route-level maxDuration A longer bounded invocation, subject to the plan ceiling.
A supported Node.js or Python function needs as much as 30 minutes Extended-duration Function beta An 1,800-second per-function limit where the beta is available.
A small task can continue after the response waitUntil Post-response execution tied to the current function lifecycle.
A multi-step job needs pause/resume, retained state, retries, and crash recovery Workflow Durable orchestration rather than one long request.
Events need buffering, at-least-once delivery, retries, or consumer fan-out Queues with consumers Durable topics that separate producers from processing capacity.
A process must continuously pull work without an HTTP request Daemon A continuously running containerized background worker on Fluid Compute.
You need a complete HTTP backend or custom server process Vercel Services The backend-oriented deployment model for servers and background workers.

These choices can be combined. For example, an HTTP Function can accept a request and publish a job to a Queue; a Daemon can consume the queue continuously; and a Workflow can coordinate several durable steps around the same job. The Function should return a job identifier instead of holding the client connection open.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand Function duration before increasing it

Fluid Compute’s documented default execution time is 300 seconds (five minutes) on every plan. Hobby has a 300-second maximum. Pro and Enterprise can reach 800 seconds. Vercel also documents an extended-duration beta allowing up to 1,800 seconds (30 minutes) per function for supported Node.js and Python runtimes. These are ceilings for one invocation, not guarantees that a process will remain alive indefinitely.

#1 Best Overall
Dell Optiplex 3060 Desktop Computer | Intel i5-8500 (3.2) | 32GB DDR4 RAM | 1TB SSD Solid State | Built in WiFi | Bluetooth | Windows 11 Professional | Home or Office PC (Renewed)
  • [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
  • [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
  • [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
  • [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
  • [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)

A route-level maxDuration setting is useful only when the work fits inside the maximum available to the project’s plan and runtime. Raising the setting cannot exceed that plan ceiling. Set it explicitly for a bounded route so its intended budget is visible during maintenance and review.

Next.js route example

export const maxDuration = 800;

export async function POST(request) {
  const input = await request.json();
  const result = await runBoundedTask(input);
  return Response.json(result);
}

The value in this example is appropriate only for a plan and runtime that permit 800 seconds. On Hobby, the invocation still cannot run beyond 300 seconds. A handler that never returns will eventually hit the applicable limit and produce a timeout, so increasing maxDuration is not a solution for an unbounded loop.

When a longer Function is the right choice

  • The task has a known upper bound and normally completes within that bound.
  • Repeating the entire operation after a failure is acceptable.
  • The client can wait, or another short-lived endpoint can poll for completion.
  • You do not need progress to survive a process restart or deployment.

If any of those assumptions fail, move the work to a durable design rather than continually extending the request timeout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use waitUntil for short post-response work, not as an always-on worker

Fluid Compute supports an extended function lifecycle through waitUntil. It lets a handler send the HTTP response and then perform a small amount of follow-up work such as logging, analytics, or a database update. The response is no longer blocked, but the task remains attached to the invocation lifecycle.

import { waitUntil } from '@vercel/functions';

export async function POST(request) {
  const payload = await request.json();

  waitUntil(recordAuditEvent(payload));

  return Response.json({ accepted: true });
}

Treat the promise as best-effort work within the function’s remaining lifecycle. It is not a separate process, has no unlimited runtime, and does not by itself retain state through a crash, pause, or deployment. Do not put a video transcode, unbounded import, or queue consumer loop in waitUntil. Publish durable work to a Queue or start a Workflow instead.

Good and bad uses

  • Good: write an audit record after returning a successful response, send a non-critical notification, or flush a small analytics event.
  • Bad: wait for an unknown number of pages, poll an external system forever, or process a backlog that may exceed the function ceiling.

If the post-response operation is business-critical, persist a job record or enqueue it before responding. The caller then receives an identifier that can be retried or inspected independently of the original request.

Put durable work behind a Queue when delivery and buffering matter

Queues provide durable topics, retries, and consumer fan-out. They are the useful boundary when a producer should not know which worker is available or when a burst of requests must be absorbed instead of making every request perform the work synchronously.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
UGREEN NAS DH2300 2-Bay for Beginners & Personal Users, Phone Backup | AI Album, Private Cloud/Remote Access, File Sharing, Multi-Device Backup, Home Entertainment, 4GB RAM on Board (Diskless)
  • Entry-level NAS Personal Storage:UGREEN NAS DH2300 is your first and best NAS made easy. It is designed for beginners who want a simple, private way to store videos, photos and personal files, which is intuitive for users moving from cloud storage or external drives and move away from scattered date across devices. This entry-level NAS 2-bay perfect for personal entertainment, photo storage, and easy data backup (doesn't support Docker or virtual machines).
  • Set Your Devices Free, Expand Your Digital World: This unified storage hub supports massive capacity up to 64TB.*Storage drives not included. Stop Deleting, Start Storing. You can store 22 million 3MB images, or 2 million 30MB songs, or 43K 1.5GB movies or 67 million 1MB documents! UGREEN NAS is a better way to free up storage across all your devices such as phones, computers, tablets and also does automatic backups across devices regardless of the operating system—Window, iOS, Android or macOS.
  • The Smarter Long-term Way to Store: Unlike cloud storage with recurring monthly fees, a UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $459.98 for a NAS, while for cloud storage, you need to pay $719.88 per year, $2,159.64 for 3 years, $3,599.40 for 5 years. You will save $6,738.82 over 10 years with UGREEN NAS! *NAS cost based on DH2300 + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
  • Blazing Speed, Minimal Power: Equipped with a high-performance processor, 1GbE port, and 4GB RAM on Board, this NAS handles multiple tasks with ease. File transfers reach up to 125MB/s—a 1GB file takes only 8 seconds. Don't let slow clouds hold you back; they often need over 100 seconds for the same task. The difference is clear.
  • Let AI Better Organize Your Memories: UGREEN NAS uses AI to tag faces, locations, texts, and objects—so you can effortlessly find any photo by searching for who or what's in it in seconds. It also automatically finds and deletes similar or duplicate photo, backs up live photos and allows you to share them with your friends or family with just one tap. Everything stays effortlessly organized, powered by intelligent tagging and recognition.

Producer pattern

  1. Validate the incoming request and create a unique job identifier.
  2. Persist the job’s initial state, such as queued, in the system of record.
  3. Publish a message containing the identifier and the minimum data required to process it.
  4. Return an accepted response with the identifier; do not keep the HTTP request open while waiting for completion.

The queue’s at-least-once delivery model means a message can be delivered more than once. Consumers must therefore tolerate duplicates. Store a processed-event or idempotency key, use upserts where possible, and make irreversible operations conditional on a state transition that can happen only once.

Consumer choices

  • A Daemon is appropriate when a continuously running process should pull messages and work through them in a loop.
  • A Function consumer fits short, independent messages whose processing time remains within the invocation ceiling.
  • A Workflow consumer fits messages that launch several durable steps or need explicit pause and resume.

Queue buffering separates arrival rate from processing rate, but it does not automatically make application side effects idempotent. A successful database write followed by a lost acknowledgement can cause the same message to be delivered again; the consumer must make that second attempt harmless.

Use Workflow when a job must survive failures and deployments

Workflow is Vercel’s durable option for work beyond a single function duration. Vercel describes it as providing pause and resume, retained state, automatic retries, and crash-safe execution. Instead of one invocation holding all progress in memory, each durable step records enough state for the orchestration to continue after a failure.

Model the job as explicit steps

  1. Accept: create a job record and return its identifier to the caller.
  2. Fetch: download or read the input, recording the source and a checksum if the data can change.
  3. Process: perform a bounded unit of computation and persist its output or checkpoint.
  4. Commit: apply the business-side effect with an idempotency key.
  5. Notify: update the job status and send a completion event.

Keep each step narrow enough to retry safely. A retry may follow a timeout in which the remote service actually completed the operation, so the step should check for an existing result before doing the work again. For external APIs that support idempotency keys, pass the same key on every attempt.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When Workflow is preferable to a Daemon

Choose Workflow when the central requirement is durability of each job: progress must be retained, a failed step should retry automatically, and a deployment or pause must not erase the current state. Choose a Daemon when the central requirement is process continuity: a worker should stay alive and continuously pull work. Many production systems use both, with a Daemon consuming a queue and launching or advancing durable workflows.

Run a Daemon for a genuinely always-on worker

Vercel describes Daemons as containers deployed as continuously running background workers on Fluid Compute. The backend documentation says a Daemon can pull work from queues or other systems without exposing an HTTP server. This is the direct match for a worker that must remain active between requests.

Daemon architecture

  1. Build a worker image or container entry point that starts the consumer loop rather than an HTTP listener.
  2. Load configuration from environment variables, including the queue address, credentials, polling interval, and concurrency limit.
  3. Poll or receive work from the queue or another supported system.
  4. Process one message with an idempotency key and write progress to durable storage.
  5. Acknowledge only after the side effect is committed. If processing fails, allow the message to be retried according to the queue’s policy.
  6. Emit structured logs containing the job identifier, attempt number, step, duration, and outcome.
async function runWorker() {
  for (;;) {
    const message = await receiveMessage();

    if (!message) {
      await sleepUntilNextPoll();
      continue;
    }

    try {
      await processIdempotently(message);
      await acknowledge(message);
    } catch (error) {
      await recordFailure(message, error);
      await releaseForRetry(message);
    }
  }
}

runWorker();

The function names above are illustrative; use the receive, acknowledgement, and retry operations exposed by your queue. The important ordering is to acknowledge after durable completion, not immediately after receiving the message.

Rank #3
Sale
UGREEN NAS DXP2800 2-Bay for Advanced Home Users, Remote Workers & Creators | Home Media & Data Center, Docker & VM, Plex, Fast File Transfer, Intel N100, 8GB DDR5, 2.5GbE, 2x M.2 NVMe, 4K HDMI(Diskless)
  • 【Advanced Home Data & Media Hub】For advanced home users who need phone backup, file storage, and centralized data management. Centralize family photos, 4K videos, movies, computer backups, and personal files in one place while running multiple apps for home entertainment and everyday data management. Suitable for households with growing digital libraries and multiple NAS use cases.
  • 【Built for Creators, Media Servers & Advanced Apps】Powered by the Intel N100 Quad-Core CPU, 8GB DDR5 RAM, 2.5GbE networking, and dual M.2 NVMe slots, DXP2800 handles large files and heavier workloads with ease. Run Docker, virtual machines, and media server applications compatible with Plex—ideal for content creators, tech enthusiasts, and advanced home users managing 4K videos, RAW photos, personal media libraries, and multiple NAS apps.
  • 【Up to 80TB for Growing Digital Libraries】 Supports up to 80TB of storage using two HDD bays and two M.2 NVMe SSD slots for family photos, movies, RAW photos, 4K videos, work files, and device backups. AI photo management supports recognition of people, objects, scenes, and locations, album organization, and duplicate photo detection. HDDs and SSDs are not included.
  • 【AI-powered Home Surveillance】Turn DXP2800 into a centralized home surveillance hub by connecting compatible network cameras and storing recordings locally on your NAS. AI-powered features include Face Recognition, People Detection, and Pet Detection, helping advanced home users review important events more efficiently while managing home surveillance and personal data in one place.
  • 【One data Center Across Your Devices】Keep files from desktops, laptops, phones, tablets, and other devices together instead of scattered across cloud accounts and external drives. Access, back up, organize, and share data across Windows, macOS, Android, iOS, web browsers, and compatible smart TVs—ideal for creators and advanced home users working across multiple devices.

What “always-on” does and does not mean

A Daemon removes the request-response duration limit from the worker loop, but it does not turn in-memory variables into durable storage. A process can still crash, be replaced, or lose its connection to a dependency. Keep the queue as the source of pending work and persist job state outside the process. If a job must continue through a crash or deployment with exact step recovery, use Workflow or combine the Daemon with a durable workflow.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Because a Daemon does not require an HTTP server, do not add a dummy health endpoint merely to keep it alive. Use the worker’s logs and the platform’s process and deployment status for operational visibility.

Use Vercel Services for a full backend process

Vercel’s backend guidance presents Services for HTTP servers and background workers. This is the suitable model when the application needs a custom server process rather than a request-scoped Function, a queue consumer Daemon, or a Workflow. It can host the server-facing part of a system while separate workers handle asynchronous jobs.

Do not select Services solely because a Function timed out once. First determine whether the task is bounded, durable, or continuously consuming work. A Service adds a server deployment model; it does not remove the need for durable queues, retry-safe side effects, or persisted state.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A practical implementation blueprint

1. Classify the workload

  • Measure the worst-case runtime, not just the average.
  • List every external side effect and decide whether it can be repeated safely.
  • Mark whether the job must survive a process crash, a deployment, or a deliberate pause.
  • Decide whether work arrives in bursts and whether producers should wait for consumers.

2. Keep the request handler short

Authenticate and validate the request, create a job identifier, persist the initial state, and enqueue or start the durable operation. Return a clear accepted response. A status endpoint can read the persisted state without rerunning the job.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Choose the execution layer

  • Use a Function for a bounded operation under the applicable 300-, 800-, or 1,800-second ceiling.
  • Use waitUntil for small, non-critical follow-up work after the response.
  • Use a Queue when delivery, buffering, retries, or fan-out are requirements.
  • Use Workflow when progress and recovery must be retained step by step.
  • Use a Daemon when a process must continuously pull work.

4. Make retries safe before enabling them

Assign an idempotency key at job creation and pass it through every step. Record state transitions such as queued, running, succeeded, and failed with timestamps and attempt counts. A retry should inspect the recorded state before repeating an operation.

5. Operate from evidence

Log the job identifier and attempt number on every line. Record queue latency separately from processing time so a growing backlog is distinguishable from slow code. Alert on repeated failures, messages that exceed their retry policy, and jobs that remain in an intermediate state longer than their business deadline.

Rank #4
Dell PowerEdge R730xd Server 24B SFF 2U, 2X Intel Xeon E5-2690 v4 2.6Ghz (28-cores Total), 128GB DDR4 RAM, 4X 1.2TB 10K SAS 2.5” 12Gb/s HDD, H730P 2GB RAID, NIC 10Gb + I350 1Gb (Renewed)
  • Dell PowerEdge R730xd 24B SFF 2U Server
  • 2x Intel Xeon E5-2690 v4 2.6Ghz 14-Core (28-cores Total)
  • 128GB DDR4 RAM – 4x 1.2TB 10K SAS 2.5” 12Gb/s
  • Dell H730P mini 2GB 12Gb/s RAID
  • 2x 750W PSU - 2x 10Gb SFP+ 2x 1Gb (RJ45) NIC

Diagnose the common timeout and reliability failures

“The function times out at five minutes”

Check the project plan, runtime, and route configuration. Five minutes is the default on all plans and the Hobby maximum. Pro and Enterprise can go to 800 seconds, while the 1,800-second beta applies only to supported Node.js and Python runtimes. If the real workload is longer or unbounded, move it to Workflow, a Queue consumer, or a Daemon instead of raising the timeout repeatedly.

“The response returned, but the background task stopped”

Determine whether the code was merely an unawaited promise or was registered with waitUntil. Even a correctly registered task remains tied to the function lifecycle. For work that cannot be lost, persist it and enqueue it or run it as a Workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Messages are processed twice”

At-least-once delivery and retries make duplicates normal. Look for a side effect performed before acknowledgement, a worker crash after completion, or an acknowledgement that was not received. Add an idempotency key and make the write conditional on the job’s current state.

“A deployment interrupts the job”

Do not rely on a process’s memory to hold the only copy of progress. Store pending work in a Queue and step state in durable storage. Use Workflow when the platform must resume the exact multi-step operation after interruption.

“The worker is alive but no jobs complete”

  • Verify that the Daemon has valid queue credentials and is reading the intended topic.
  • Check whether messages are being acknowledged before processing finishes.
  • Inspect dependency timeouts and connection errors in structured logs.
  • Confirm that the consumer’s concurrency does not exceed the downstream service’s limits.
  • Check for a retry loop that continually releases the same poison message without recording the cause.

Plan availability, duration, and cost carefully

The documented duration limits are plan-dependent: Hobby tops out at 300 seconds, while Pro and Enterprise reach 800 seconds. The extended 1,800-second limit is a beta capability for supported Node.js and Python runtimes, so availability can change. Fluid Compute and waitUntil are documented as available across plans, but waitUntil remains lifecycle-bound.

No single fixed cost can be inferred from the execution model alone. Your bill depends on the Vercel plan, compute duration, memory, invocations, storage, and any queue or external services used. Treat Daemons, Functions, Workflows, and queue consumers as separate capacity decisions and verify current plan terms before committing to an architecture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deployment checklist

  • Write down the maximum runtime and the failure behavior for every job type.
  • Set route-level maxDuration only for bounded Functions and confirm the plan ceiling.
  • Return a job identifier instead of holding an HTTP request open for durable work.
  • Persist state before acknowledging a queue message.
  • Make every externally visible side effect idempotent.
  • Use waitUntil only for short post-response tasks that can tolerate the function lifecycle.
  • Choose Workflow for pause/resume and crash-safe multi-step execution.
  • Choose a Daemon for a continuously running queue or system consumer without an HTTP server.
  • Log identifiers, attempts, durations, and errors so timeouts and retries can be traced.
  • Test a crash after processing but before acknowledgement, then verify that the retry does not duplicate the result.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Background jobsDaemonsDevOpsFluid computequeuesserverlessVercelWorkflow

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.