New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache the entire bolt backend into memory before restoring index #3786
Comments
@xiang90 Even though the keys are written sequentially, bolt may write them randomly since it reuses old pages when available. One easy fix, if you're targeting Linux 2.6.23+, is to add an |
Actually, this is a newly created db with all seq writes.
I will give it a try. |
Thanks btw. I will let you know the result soon! |
Even with sequential writes, bolt will still have pages it will reuse because of the freelist being written and partially filled data pages. Those will get filled on the next transaction and the old half filled page will be available for reuse.
You'll need to add the |
Fixed by #3865 |
This adds MmapFlags to DB.Options in case we need syscall.MAP_POPULATE flag in Linux 2.6.23+ to do the sequential read-ahead, as discussed in [1]. --- [1]: etcd-io/etcd#3786
etcd has an in-mem secondary index for the entire db. Reading the entire boltdb without moving the db file into page cache is slow. It is OK for etcd to scan the entire file first and let os move all file into page cache. It increase the throughput of read from 6K/second to 2M/second with very little overhead (pre read ingthe whole db has a throughput around 300MB/second on SSD)
@benbjohnson Do you have any suggestion? If boltdb just supports warm-up, it would be great. But I still wonder why doing a
seq read
on a seq written db without warm-up is so slow.The text was updated successfully, but these errors were encountered: