-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
What version of Go are you using (go version)?
$ go version go version go1.14
What operating system are you using?
amd64, dockerized
What version of Badger are you using?
v2.0.3
Does this issue reproduce with the latest master?
Probably, yes, I can't test it in my current setup.
Steps to Reproduce the issue
I have badger DB working as in-memory key-value store. Entry size is 3kb on avarage, there's approx. 400k entries with 150k read requests/minute, but they change frequently: 15k/minute.
What Badger options were set?
opts := badger.DefaultOptions("").
WithInMemory(true)
What did you expect to see?
I expected to see stable response time for any read operation, but currently there's strange spikes in response time:

I've spent some time with documentation and sources, but failed to reproduce issue locally and to find desired combination to get rid of them. Setting WithSyncWrites(false), for example, fixes issue, but memory usage keeps growing until OOM. Tweaking MaxTableSize or NumCompactors affects response time, but doesn't fix issue completely. Interestingly, read perfomance during spike degrades than the writing load increases, as I understood, this is somehow related to periodic compaction of entries, but I have no idea how to approach the problem.
The desired scenario for me is stable read time under 100ms, I don't care about write perfomance since it's always happens
asynchronously. Also does not care pretty much about higher memory or cpu usage, as long as it's stable and predictable.
Which configuration should I use for my use case?
Thanks you for awesome work! Sorry for any grammar mistakes, I'm not native speaker.