Search code examples
google-cloud-spanner

Cloud Spanner: Overhead of running in profile mode


What is the overhead of running queries in profile mode? We are mostly concerned about throughput not latency in our workload and are thinking of creative ways about capturing metrics as part of our app, for example, to do chargebacks based on resource usage.

Presumably there’s a fixed cost to profiling. What would we expect? Is there a variable component as well? If so, what does it depend on?


Solution

  • The overhead depends on the specific query and it is hard to quantify it. The ballpark is ~5% reduction in throughput. The overhead includes fixed cost and small additional cost for every row scanned.

    The overhead is significant enough that spanner recommends that profiling is enabled at a fraction of queries. For example random 1% of the queries.