Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

do not grow dbsize agressively #453

Merged
merged 1 commit into from
Jan 11, 2016
Merged

do not grow dbsize agressively #453

merged 1 commit into from
Jan 11, 2016

Conversation

xiang90
Copy link
Contributor

@xiang90 xiang90 commented Nov 6, 2015

Only grow the database size when the high watermark increases.
We also grows the database size a little bit aggressively to
save a few ftruncates and fsyncs.

I have tested this on various environments. The performance impact
is ignorable with 16MB over allocation. Without over allocation,
the performance might decrease 100% when each Tx.Commit needs a new
page on a very slow disk (seek time dominates the total write).

We will not overallocate 16MB when the database is small since it also
limits by the datasz.

Only grow the database size when the high watermark increases.
We also grows the database size a little bit aggressively to
save a few ftruncates.

I have tested this on various environments. The performance impact
is ignorable with 16MB over allocation. Without over allocation,
the performance might decrease 100% when each Tx.Commit needs a new
page on a very slow disk (seek time dominates the total write).
// do not over allocate
if sz > db.datasz {
sz = db.datasz
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if sz < db.datasz ?
Why add overAllocation and then discard it ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved overAllocation to DB.AllocSize in a122e1c so it can be configurable.

@gyuho
Copy link
Contributor

gyuho commented Dec 30, 2015

Kindly ping @benbjohnson. Following up with #472, etcd needs this patch as well. It would be great if you can take a look at this.

Thanks!

@benbjohnson benbjohnson merged commit e67705e into boltdb:master Jan 11, 2016
@benbjohnson
Copy link
Member

@gyuho @xiang90 Sorry for the delay. It takes me a couple hours to go through Bolt PRs (even simple ones) and it's been hard to find the time. I merged the changes and made some minor changes in a122e1c:

  1. Move overAllocation to DB.AllocSize so that it's configurable.
  2. Minor cosmetic clean up.

@gyuho
Copy link
Contributor

gyuho commented Jan 11, 2016

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants