# Disk space management issue

**URL:** <https://www.singlestore.com/forum/t/disk-space-management-issue/2632>\
**Category:** Help\
**Created:** [December 22, 2020, 11:28am UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632 "2020-12-22T11:28:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierre](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/pierre/32/784_2.png) [@pierre](https://www.singlestore.com/forum/u/pierre)\
**Post date:** [December 22, 2020, 11:28am UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/1 "2020-12-22T11:28:12Z")

</div>

Hello guys,

I’ve a cluster with the following 6 databases:

 ![dbs](https://forum-prod-assets20231213123829991800000001.s3.dualstack.us-east-1.amazonaws.com/original/1X/ac696cff9bc4c805852fb6fe2394d1f70b9fc4a4.png)

The nodes take more than 42G of disk:

 ![nodes](https://forum-prod-assets20231213123829991800000001.s3.dualstack.us-east-1.amazonaws.com/original/1X/5478edc792d124c695935bed573c8a5157258346.png)

The top 5 disk usage folders are:  
 ![du](https://forum-prod-assets20231213123829991800000001.s3.dualstack.us-east-1.amazonaws.com/original/1X/6a548bd97aeca513c6125a9bd8b170a349147d40.png)

So far I did:

- reducing the `snapshots_to_keep` to 1
- log\_file\_size\_partitions from 256mb to 64mb

However, the old log files remained at 256mb.

Most of these empty databases have more than 30 log files that looks like:

- db\_name\_1\_log\_v1\_0
- db\_name\_1\_log\_v1\_65536
- and so on…

Could you please tell us how to clean/manage those log files automatically to avoid running out of disk space?

Looks like it’s a recurring pain point and I couldn’t find more resources about it…

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![adam](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.singlestore.com/forum/u/adam)\
**Post date:** [December 22, 2020, 7:16pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/2 "2020-12-22T19:16:04Z")

</div>

Hi,

Changing log\_file\_size\_partitions only impacts newly created databases as you noted.

Another knob you can modify to reduce space is snapshot\_trigger\_size, which is how much log we allow to accumulate on disk before a snapshot is taken. Its set to 1 GB by default.

-Adam

---

<div class="post-metadata">

**Author:** ![hanson](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/hanson/32/196_2.png) [@hanson](https://www.singlestore.com/forum/u/hanson)\
**Post date:** [December 22, 2020, 8:37pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/3 "2020-12-22T20:37:11Z")

</div>

See Adam’s earlier post for some context. We pre-allocate large log files since 7.0, and they will fill up with user data if you use the DB significantly. So the issue is mostly for empty DBs. And disk is cheap these days.

> [@Partition log file size](https://www.singlestore.com/forum/t/partition-log-file-size/2174/5):
>
> Just to add a bit of context there, those log files are pre-allocated on create database so we don’t need to allocate them while committing transactions. If you write data to the database they will fill up with user data. So this only impacts things for empty or mostly empty databases (disk is very cheap these days, so the default configuration errs on the side of performance by using up 1/2 GB of disk per partition for empty databases).

---

<div class="post-metadata">

**Author:** ![pierre](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/pierre/32/784_2.png) [@pierre](https://www.singlestore.com/forum/u/pierre)\
**Post date:** [December 23, 2020, 6:06pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/4 "2020-12-23T18:06:14Z")

</div>

Thanks @adam, @hanson for your answers,

In my use case I’m creating a DB per “project” and as a SaaS it might have hundreds of “projects”… it won’t be cost effective to reserve 6go on every node for each database that might remain empty.

I expect the active databases to grow at 5-10go / year, could you please give me insights on the right `log_file_size_partitions` to use?

What is the impact of having a `log_file_size_partitions` at 8mo? 16mo? 64mo?

Thanks

---

<div class="post-metadata">

**Author:** ![adam](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.singlestore.com/forum/u/adam)\
**Post date:** [December 23, 2020, 7:24pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/5 "2020-12-23T19:24:17Z")

</div>

A few things on log\_file\_size:

- It mainly impacts write throughput when there is a sustained burst of rowstore writes. You could see dips in throughput when we need to create new log files due to having it smaller - how much so depends more on your disk throughput . If your workload is mostly columnstore its unlikely you would notice anything. Setting it to 64 mb should be fine.
- This only saves you space for mostly empty databases. It doesn’t save space for database with data in them

Probably the best way to save disk space is to use fewer partitions for some of your smaller databases (I see you are already going that a bit. Some of them are 8 partitions vs 16). You can increase the partition count later, but it is an offline operation right now.

---

<div class="post-metadata">

**Author:** ![pierre](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/pierre/32/784_2.png) [@pierre](https://www.singlestore.com/forum/u/pierre)\
**Post date:** [December 23, 2020, 8:38pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/6 "2020-12-23T20:38:46Z")

</div>

Alright, thank you for the details!

Can you confirm that reducing the number of partitions will also reduce the parallelism of the queries, and increase the response time for CPU-intensive queries?

Thanks

---

<div class="post-metadata">

**Author:** ![adam](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.singlestore.com/forum/u/adam)\
**Post date:** [December 23, 2020, 8:54pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/7 "2020-12-23T20:54:06Z")

</div>

That’s correct. Reducing the partition count reduces parallelism.

-Adam

---

<div class="post-metadata">

**Author:** ![hanson](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/hanson/32/196_2.png) [@hanson](https://www.singlestore.com/forum/u/hanson)\
**Post date:** [December 23, 2020, 10:34pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/8 "2020-12-23T22:34:44Z")

</div>

@pierre where are you going to run your databases and what are you going to have to pay for storage (say per GB per month)?

---

<div class="post-metadata">

**Author:** ![pierre](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/pierre/32/784_2.png) [@pierre](https://www.singlestore.com/forum/u/pierre)\
**Post date:** [December 24, 2020, 11:19pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/9 "2020-12-24T23:19:36Z")

</div>

The actual rate for Google Compute Engine SSD disks in my location is $8.5 /mo for 50G (without snapshots).

If the cluster is not taking more space per empty DB it’s fine, but coming from other engines (MySQL, Mongo…) it’s shocking to see 42G used for 200mo of data!

Can you confirm that a 4 vCPU node will process a 4 partitions db as fast as a 8 partitions, when it receives a query?

Thanks

---

<div class="post-metadata">

**Author:** ![adam](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.singlestore.com/forum/u/adam)\
**Post date:** [December 30, 2020, 7:25pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/10 "2020-12-30T19:25:11Z")

</div>

For most query shapes that’s correct Pierre. 4 partitions on a 4 vCPU node is optimal.

And yeah, we don’t really optimize disk usage for the many small databases case. The system is more optimized for fewer larger databases (so this is why it does more upfront disk allocation for each database).

-Adam

---

<div class="post-metadata">

**Author:** ![idabgilliam40](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/i/58f4c7/32.png) [@idabgilliam40](https://www.singlestore.com/forum/u/idabgilliam40)\
**Post date:** [September 6, 2021, 12:11pm UTC](https://www.singlestore.com/forum/t/disk-space-management-issue/2632/11 "2021-09-06T12:11:02Z")

</div>

use disk space analyzer , TreeSize is the best disk space analyzer but there are also many disk space analyzers [you can also try them](https://www.techshout.com/treesize-alternative/)
