sailfork / t3code-github / .repos/ alchemy-effect/ website/ src/ content/ docs/ gcp/ compute/ choosing-a-runtime.mdx

Every Alchemy app on GCP needs somewhere for its code to run. Each runtime takes the same Effect program: you bundle it with main, bind resources to it, and Alchemy grants the IAM.

  • Cloud Run service (GCP.Function) — an HTTP server that scales to zero. Use this by default.
  • Cloud Run job (GCP.Run.Job) — a batch task that runs to completion and exits.
  • Cloud Run worker pool (GCP.Run.WorkerPool) — always-on containers with no URL, for queue consumers.
  • Cloud Function (GCP.CloudFunctions.Function) — an HTTP function built in the cloud, with no local Docker.
  • GKE (Kubernetes.Deployment on GCP.Container.Cluster) — Kubernetes workloads on a cluster you own.

At a glance

ServiceJobWorker poolCloud FunctionGKE
Entryfetchrunrun or a pull event sourcefetchfetch or run
Triggered byHTTP, push event sourcesRunJob, Cloud SchedulerNothing: always runningHTTP, push event sourcesHTTP via a load balancer, Jobs on apply
Cost shapePer request; zero idlePer execution; zero idlePer running instancePer request; zero idleCluster plus pods
PackagingImage built locallyImage built locallyImage built locallySource built by GoogleImage built locally
Deploy timeAbout a minuteAbout a minuteAbout a minuteA few minutesCluster: ~10 min. Pods: seconds

Cloud Run service — the default

An HTTP container that scales with traffic and down to zero. It serves many requests per instance, streams responses, and runs your fetch handler as-is. Pub/Sub, Cloud Storage, Cloud Scheduler, and Eventarc can all push to it.

→ Cloud Run

Cloud Run job — batch work

A container with a run entry. It starts, does the work, and exits. Nothing is billed between executions. Start it from a service with the RunJob binding, or on a timer with Cloud Scheduler.

→ Cloud Run jobs

Cloud Run worker pool — background consumers

A pool of containers with no URL. It suits a worker that pulls from Pub/Sub around the clock and should keep running whether or not anyone sends HTTP traffic.

→ Worker pools

Cloud Functions — no Docker needed

A 2nd-gen Cloud Function runs on Cloud Run underneath. The difference is the build: Alchemy uploads your bundled program and Google builds it, so you can deploy from a machine without Docker.

→ Cloud Functions

GKE — Kubernetes

Reach for GKE when you need Kubernetes itself: Helm charts, long-lived pods, custom networking, or workloads you already run elsewhere. Bindings work the same way. They grant roles to the pod's identity through Workload Identity.

→ GKE

Where next