How Cloud Run's per-instance concurrency setting interacts with CPU, autoscaling and your database connection limit, how to pick a value with a load test, and when to set it to 1.

Cloud Run bills and scales by instance, and the concurrency setting decides how many requests each instance takes at once. Leave it at the default of 80 and a Go service that waits on Postgres can run on a handful of instances; set it to 1 and the same traffic needs dozens, each with its own cold start and its own database connections.
Set it too high and a CPU-heavy endpoint drives latency up before autoscaling notices. Set it too low and you pay for idle instances while your database runs out of connections. This guide covers how the setting interacts with autoscaling, how to pick a number, and how it ties into your connection pool.
The Cloud Run concurrency docs describe the limits and the autoscaling behaviour.
Cloud Run adds instances when existing ones approach the concurrency limit or when CPU utilization stays above roughly 60 percent, as described in the autoscaling guide. The concurrency setting is a maximum, not a target: an instance with a limit of 80 may run at 20 requests if CPU is what triggers scaling first.
CPU-bound services rarely benefit from high concurrency for this reason. Eighty concurrent image resizes on one vCPU all wait for the same core, and the CPU signal adds instances anyway. For those, a lower value such as 4 to 8 per vCPU keeps latency predictable.
Deploy one instance with a high limit and a maximum of one instance, then step load up and watch latency:
Note the concurrency where p95 latency starts to climb or errors appear, and set the production value around 70 percent of it. Then remove the instance cap and set --max-instances from your database budget, below.
Every instance opens its own pool, so the database sees max instances × pool size in the worst case, plus whatever migrations, cron jobs and humans use. A Cloud SQL instance with max_connections of 400, a pool of 20 per instance and 25 maximum instances is at 500, which fails during a traffic spike rather than at rest.
Higher concurrency with a moderately sized pool is often the cheapest fix: one instance serving 100 requests over 20 connections is fine when queries take milliseconds. The database connection pooling guide covers pool sizing in more depth.
Best fit: concurrency between 50 and 250 for I/O-bound APIs, 4 to 8 per vCPU for CPU-heavy work, 1 only when the code demands it, and a maximum instance count derived from the database.
Encore brings infrastructure from code, and on GCP it runs services on Cloud Run or GKE with Cloud SQL for each database you declare. The connection pool is part of Encore's runtime: the Go runtime opens up to 30 connections per database per process by default, with connection lifetimes jittered so instances started by the same deploy do not all reconnect at once. Your budget is running instances times 30 for each database a process uses.
package orders
import (
"context"
"encore.dev/storage/sqldb"
)
// One pool per process, shared by every concurrent request in that instance.
var db = sqldb.NewDatabase("orders", sqldb.DatabaseConfig{Migrations: "./migrations"})
type Order struct {
ID string `json:"id"`
Status string `json:"status"`
}
//encore:api public method=GET path=/orders/:id
func Get(ctx context.Context, id string) (*Order, error) {
o := &Order{ID: id}
err := db.QueryRow(ctx, `SELECT status FROM orders WHERE id = $1`, id).Scan(&o.Status)
return o, err
}
Process allocation changes the math. With all services in one process, every service shares one pool per database; with one process per service, each Cloud Run service brings its own pool, which multiplies connections by the number of services using that database. The Cloud Run services live in your project, so concurrency and maximum instances can be adjusted in the Google Cloud console, and Encore's configuration docs describe deploys that leave such changes in place.
Pub/Sub subscriptions on Cloud Run are a special case: for at-least-once topics Encore configures push subscriptions, and the MaxConcurrency setting does not apply there, since Pub/Sub adapts the push rate to how fast instances respond, as the SDK documentation notes.
When an agent adds a new service that touches an existing database, the pool comes with the runtime rather than from hand-written setup, so the connection math above stays the one thing to check in review.
Best fit: Go services on Cloud Run in your own GCP project where the database pool is managed by the runtime and the main knobs are instance counts and process allocation.
Start at 80, load test, and settle on roughly 70 percent of the concurrency where latency degrades. Drop to 1 only for code that cannot share an instance. Then set maximum instances from your database: max instances times pool size, plus headroom, must stay under max_connections. On Encore, use 30 connections per database per process as the pool size in that calculation, and check how process allocation splits services across Cloud Run services.
Concurrency is the maximum number of requests one Cloud Run instance handles at the same time. The default for services is 80 and the maximum is 1,000. When all instances are at their limit, Cloud Run starts more instances, up to the service's maximum instance count.
Load test one instance and raise concurrency until latency or errors degrade, then set it somewhat below that point. I/O-bound services in Go or Node.js often handle 50 to 250 concurrent requests per instance. Use 1 only for code that cannot handle parallel requests or uses all the CPU per request.
Each instance opens its own connection pool, so the worst case is maximum instances times pool size. Higher concurrency means fewer instances for the same traffic, which helps, but you still need max instances times pool size, plus migrations and admin connections, to stay under the database's max_connections.
Encore's Go runtime opens a pool of up to 30 connections per database per process by default, so the connection budget is the number of running instances times 30 for each database a process uses. Size the Cloud SQL instance and the maximum instance count with that number in mind.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.