top | item 32713977

(no title)

chtitux | 3 years ago

I've discovered by default, CloudRun only allocates one core per HTTP request, and exclusively during request execution [0].

So your app runs at 0 CPU when there is no requests ongoing, and can't use more than 1 processes in the same container. It means you can't have a container with nginx+rails, as only nginx will have a core to execute, rails has no core and it leads to a timeout.

Maybe you should ensure your app is not trying to use a second process?

[0] https://cloud.google.com/run/docs/configuring/cpu-allocation

discuss

order

CodesInChaos|3 years ago

Only allocating CPU while a request is in progress, and thus only paying for that time, is cloud run's defining feature, so that part makes sense.

But the problems with having multiple processes are weird. I'd have expected patterns where the http server blocks while waiting for a helper process to work. That sounds like a rather annyoing limitation, and I saw no mention of it in the documentation.

Can you double check if there is really such a limitation and not a misattribution?

diceduckmonk|3 years ago

Maybe our ORM or Postgres connector runs a process. We ourselves are not directly running multiple processes.

This feels like a leaky abstraction that defeats the purpose of container-as-service especially when the intended audience is hobbyists / small teams who don't have a networking SRE, much less keeping track of fragile infrastructure assumptions.

If we have to stick with GCP, then it seems GCE VMs are a safer bet.