Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dgraph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
dgraph
Commits
04bad0eb
Commit
04bad0eb
authored
9 years ago
by
Manish R Jain
Browse files
Options
Downloads
Patches
Plain Diff
Update thoughts about BoltDB
parent
baf842c9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
store/README.md
+51
-0
51 additions, 0 deletions
store/README.md
store/store_test.go
+8
-7
8 additions, 7 deletions
store/store_test.go
with
59 additions
and
7 deletions
store/README.md
+
51
−
0
View file @
04bad0eb
...
...
@@ -33,3 +33,54 @@ BenchmarkSet_valsize1000-6 50 28066678 ns/op
BenchmarkSet_valsize10000-6 50 28736228 ns/op
ok github.com/dgraph-io/dgraph/store 48.393s
```
Also based on dgraph-io/experiments/db:
## BoltDB
Without copying the resulting byte slice from Bolt.
**Unsafe**
```
$ go test -bench BenchmarkRead .
testing: warning: no tests to run
PASS
BenchmarkReadBolt_1024 500000 3858 ns/op
BenchmarkReadBolt_10KB 500000 3738 ns/op
BenchmarkReadBolt_500KB 1000000 3141 ns/op
BenchmarkReadBolt_1MB 1000000 3026 ns/op
ok github.com/dgraph-io/experiments/db 102.513s
```
Copying the resulting byte slice.
**Safe**
```
$ go test -bench BenchmarkRead .
testing: warning: no tests to run
PASS
BenchmarkReadBolt_1024 200000 6760 ns/op
BenchmarkReadBolt_10KB 100000 21249 ns/op
BenchmarkReadBolt_500KB 10000 214449 ns/op
BenchmarkReadBolt_1MB 3000 350712 ns/op
ok github.com/dgraph-io/experiments/db 80.890s
```
## RocksDB
```
$ go test -bench BenchmarkGet .
PASS
BenchmarkGet_valsize1024 300000 5715 ns/op
BenchmarkGet_valsize10KB 50000 27619 ns/op
BenchmarkGet_valsize500KB 2000 604185 ns/op
BenchmarkGet_valsize1MB 2000 1064685 ns/op
ok github.com/dgraph-io/dgraph/store 55.029s
```
### Thoughts
DGraph uses append only commit log to sync new mutations to disk before returning.
Every time a posting list gets init, it checks for both the stored posting list and
the mutations committed after the posting list was written. Hence, our access pattern
from store is largely read-only, with fewer writes. This is true, irrespective of how
many writes get commited by the end user.
Hence, BoltDB is a better choice. It performs better for reads/seeks, despite DGraph needing
a value copy. Writes are somewhat slower, but that shouldn't be a problem because of the
above mentioned reasons.
This diff is collapsed.
Click to expand it.
store/store_test.go
+
8
−
7
View file @
04bad0eb
...
...
@@ -82,7 +82,6 @@ func benchmarkGet(valSize int, b *testing.B) {
return
}
}
b
.
Logf
(
"Wrote %d keys."
,
nkeys
)
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
...
...
@@ -98,9 +97,10 @@ func benchmarkGet(valSize int, b *testing.B) {
}
}
func
BenchmarkGet_valsize100
(
b
*
testing
.
B
)
{
benchmarkGet
(
100
,
b
)
}
func
BenchmarkGet_valsize1000
(
b
*
testing
.
B
)
{
benchmarkGet
(
1000
,
b
)
}
func
BenchmarkGet_valsize10000
(
b
*
testing
.
B
)
{
benchmarkGet
(
10000
,
b
)
}
func
BenchmarkGet_valsize1024
(
b
*
testing
.
B
)
{
benchmarkGet
(
1024
,
b
)
}
func
BenchmarkGet_valsize10KB
(
b
*
testing
.
B
)
{
benchmarkGet
(
10240
,
b
)
}
func
BenchmarkGet_valsize500KB
(
b
*
testing
.
B
)
{
benchmarkGet
(
1
<<
19
,
b
)
}
func
BenchmarkGet_valsize1MB
(
b
*
testing
.
B
)
{
benchmarkGet
(
1
<<
20
,
b
)
}
func
benchmarkSet
(
valSize
int
,
b
*
testing
.
B
)
{
path
,
err
:=
ioutil
.
TempDir
(
""
,
"storetest_"
)
...
...
@@ -125,6 +125,7 @@ func benchmarkSet(valSize int, b *testing.B) {
}
}
func
BenchmarkSet_valsize100
(
b
*
testing
.
B
)
{
benchmarkSet
(
100
,
b
)
}
func
BenchmarkSet_valsize1000
(
b
*
testing
.
B
)
{
benchmarkSet
(
1000
,
b
)
}
func
BenchmarkSet_valsize10000
(
b
*
testing
.
B
)
{
benchmarkSet
(
10000
,
b
)
}
func
BenchmarkSet_valsize1024
(
b
*
testing
.
B
)
{
benchmarkSet
(
1024
,
b
)
}
func
BenchmarkSet_valsize10KB
(
b
*
testing
.
B
)
{
benchmarkSet
(
10240
,
b
)
}
func
BenchmarkSet_valsize500KB
(
b
*
testing
.
B
)
{
benchmarkSet
(
1
<<
19
,
b
)
}
func
BenchmarkSet_valsize1MB
(
b
*
testing
.
B
)
{
benchmarkSet
(
1
<<
20
,
b
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment