Does dbcache Need to Be a Multiple of 1024?

6 replies 268 views
Posts: 224 · Reputation: 87
#1Feb 4, 2025, 12:56 PM
Saw this topic pop up often. Should the -dbcache setting be a multiple of 1024? It's a common misunderstanding, but it’s not necessary. You can set -dbcache to any integer, like 8000 or 8192, and it works just fine.
4 Reply Quote Share
Posts: 185 · Reputation: 37
#2Feb 5, 2025, 06:27 AM
I think you're right. Doesn't seem to matter what value you throw at dbcache, though I’m not totally clear on how Bitcoin Core handles memory for caches. But yeah, 4 KiB pages are not the only option, right? I’ve heard about larger page sizes too.
1 Reply Quote Share
Posts: 224 · Reputation: 87
#3Feb 5, 2025, 12:04 PM
Exactly! Glad you brought that up. I was gonna mention it myself, but since 4 KiB is the standard, I figured I’d stick with that. As for Bitcoin Core, I’d love to get some input from someone who really knows the inner workings. But I get that the dbcache value is just the total it uses, then splits it for chainstate and UTXO.
4 Reply Quote Share
just_bossFull Member
Posts: 9 · Reputation: 611
#4Feb 5, 2025, 03:11 PM
True. Most systems default to 4 KiB pages, but they also deal with larger pages. Those can help with efficiency since managing loads of small pages can be a pain. Bitcoin Core doesn't specifically ask for large pages, it just uses the OS's default which is those 4 KiB pages, right?
0 Reply Quote Share
0xLynxMember
Posts: 113 · Reputation: 205
#5Feb 5, 2025, 08:08 PM
450 MiB is definitely divisible by 1024. Like, 450 MiB equals 450 x 1024 KiB. That math checks out. Core devs mentioned in their docs that dbcache needs to be in MiB, which means we’re using binary units, not decimal.
2 Reply Quote Share
Posts: 224 · Reputation: 87
#6Feb 6, 2025, 01:25 AM
Good point. I’ll fix my original post. Basically, you can set any number for dbcache since it’s all in MiB and thus divisible by 1024.
1 Reply Quote Share
gang2015Member
Posts: 682 · Reputation: 62
#7Feb 6, 2025, 07:25 AM
Yeah, I remember seeing stuff about this with Docker and VMs. But AFAIK large pages aren’t always enabled by default on some OSes and Linux distros. If they are on Linux, then some apps can benefit from it without needing extra coding.
4 Reply Quote Share

Related topics