In a bit of a quandary. I am using Cloud Run on GCP for backend services, and it will auto-scale based on HTTP load, potentially scaling down to 0 if there is no traffic for awhile.

I have a product with 3 backend restful services running on Cloud Run, and the backend services need to communicate with each other. They could post messages directly to each other, as one option. But let's assume we want a message queue to ensure delivery of messages.

My question is - if I have a RabbitMQ subscription in each of the services - will Cloud Run know to keep the service alive? Will it know to scale up if more messages are received from Rabbit? Is it a design smell to have a restful service that also subscribes to a message queue via a TCP connection? My main concern is how Cloud Run itself keeps services alive and how it auto-scales based on the TCP message load. My guess is that Cloud Run mostly deals with HTTP messages and doesn't know how to deal with TCP connections?

One potential answer to the question is to use GCP's pub/sub instead of RabbitMQ, but I am curious if it could be solved using RabbitMQ. The problem with GCP pub/sub is that I don't want to fan out, I just want the message to be processed by one instance of a service, not all instances.

Also: Can someone create a tag "gcp" and add it the question please.

  • please explain the downvote otherwise you look like a douche Dec 14, 2020 at 5:57
  • i suppose one solution is to have permanent subscribers to the rabbit queue, and that service will post messages to the other 3 services, and if any of the 3 services aren't alive or there is some other HTTP error, then the messages won't get lost Dec 14, 2020 at 5:59


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.