Why is the average size of blk*.dat files set at 128MB?

2 replies 452 views
defi_byteMember
Posts: 2 · Reputation: 41
#1Apr 20, 2017, 10:21 AM
Hey everyone, I've been checking out how Bitcoin stores data in those blk*.dat files, and I see they usually sit around 128 to 134MB. How did they settle on this size? Is there any proof that this is the best setup?
4 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#2Apr 21, 2017, 04:49 AM
The files are capped at 128 MiB. When a block would make the file too big, a new one just gets created. That size was picked to help with disk fragmentation, according to a pull request. But honestly, I don't think there's anything that shows it's the "most efficient" size or whatever. A lot of these limits just come from a gut feeling, you know?
2 Reply Quote Share
defi_byteMember
Posts: 2 · Reputation: 41
#3Apr 21, 2017, 07:57 PM
Yeah, it makes sense not to have tons of tiny files. But when I say efficiency, I'm thinking about how that size impacts read/write speeds. Like, in the Google File System study, they found 64 MB chunks worked best for user needs, cutting down on back-and-forth with the server. Just saying, maybe we should look at how size affects performance too.
4 Reply Quote Share

Related topics