Why is CockroachDB usage increasing even though I am not writing to it?

I recently started the CockroachDB process and noticed that its disk usage continues to grow even though I stopped writing to it a few hours ago. What's happening? Is there a way to stop it from growing?

+3


source to share


1 answer


CockroachDB stores internal timers, keeping track of the data in itself to manage charts in the admin UI . This data is accumulated for 30 days before it starts to be deleted. As a result, during the first 30 days of clusters' life, you will see a steady increase in disk usage and the number of ranges in the cluster, even if you are not writing data yourself.



Since version 1.0, there is no way to change the number of days before the timer data is truncated. However, as a workaround, you can run each node with an environment variable COCKROACH_METRICS_SAMPLE_INTERVAL

set higher than its default of 10 to store fewer data points. For example, you can set it COCKROACH_METRICS_SAMPLE_INTERVAL=1m

once to collect data every 1 minute, which will save data less than 6 times the default. You can also set it to a very large value, for example COCKROACH_METRICS_SAMPLE_INTERVAL=87600h

, for sample data only once every 10 years (never actually).

+4


source







All Articles