-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(core): Add cache to dgraph.type predicate. #9068
Conversation
f58b1ab
to
f52b96e
Compare
posting/mvcc.go
Outdated
// corresponding to the key in the cache to nil. So, if we get some non-nil value from the cache | ||
// then it means that no writes have happened after the last set of this key in the cache. | ||
if l, ok := countMap.list[string(key)]; ok { | ||
if l != nil && l.maxTs < readTs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l.minTs < readTs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See whether we want to put this behind a feature flag just in case!
posting/mvcc.go
Outdated
@@ -1,25 +1,24 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo this change
posting/mvcc.go
Outdated
type GlobalCache struct { | ||
sync.RWMutex | ||
|
||
count map[string]int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a struct instead! More maps => more memory unpredictability
d9529ba
to
fab7c2d
Compare
return int64(0) | ||
} | ||
return int64(l.DeepSize()) | ||
return 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make a comment to describe why the change
Add cache to dgraph.type predicate. This would significantly help improve @filter(type) queries.
Live loader before took: 16mins 39 seconds for 21 million dataset.
Live loader now: 10mins 52 seconds.
Improvement: 38%