From 06049989582689a1373376df36a54d27cb38f84a Mon Sep 17 00:00:00 2001 From: Dennis E Date: Wed, 28 Nov 2018 09:36:05 -0800 Subject: [PATCH] Disables fsync in db operations Disabling fsync can greatly reduce the amount of unneccessary serialization of filesystem operations. --- ethdb/database.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ethdb/database.go b/ethdb/database.go index 6c62d6a386..f7b731e6ef 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -78,6 +78,7 @@ func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error) { BlockCacheCapacity: cache / 2 * opt.MiB, WriteBuffer: cache / 4 * opt.MiB, // Two of these are used internally Filter: filter.NewBloomFilter(10), + NoSync: true, }) if _, corrupted := err.(*errors.ErrCorrupted); corrupted { db, err = leveldb.RecoverFile(file, nil) @@ -371,7 +372,9 @@ func (b *ldbBatch) Delete(key []byte) error { } func (b *ldbBatch) Write() error { - return b.db.Write(b.b, nil) + return b.db.Write(b.b, &opt.WriteOptions{ + Sync: false, + }) } func (b *ldbBatch) ValueSize() int {