Optimizing costs while using Google Cloud Function for webhooks

Hey everyone! I’m currently using a Google Cloud Function as a webhook to post messages to a topic, but the costs are getting quite high. Does anyone have recommendations for a more cost-effective alternative for handling webhooks in GCP?

it’s really depend on lot of thing

Does the cloud function is compute intensive?
How frequently the webhook is called?
Does batching can be cost effective?
Does the caller need the response directly?

As generic advice, if your cloud function is called a lot, maybe cloud run can reduce the cost, as the requests will be mutualize on the same container, multiple invocations in the same time will be count as “one invocation”. But once again is depends on how much the webhook is called and if the code is concurrency safe

Thank you for the response. Yes, it is being used for streaming. Batch is not an option. I wouldn’t say it involves intensive computation, but I would like to test alternatives. The idea of using Cloud Run is interesting; thank you!