-
Notifications
You must be signed in to change notification settings - Fork 65
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
Recycle goroutine doing compaction #119
Comments
I think it's important that we keep the write path non-blocking/lock-free, so I wonder if we could find another way. Maybe we could just mark the granule to need compaction and have the compaction go routines just cycle through the granules to pick up the ones that need compaction? Happy for other suggestions but not spawning a go routine at every insert is obviously not a long term option (I think we always knew this but just punted on that when we initially wrote this). |
Yea, when I initially wrote that I played around with buffered channels as well as a mark and sweep style. This one performed the best, and until we better understood the characteristics of how it performed decided to defer solving this. |
Potentially wild idea, what if we used a sync pool for reusing goroutines? |
Never mind we would end up leaking goroutines. |
While working on #118 I realised that we create a go-routine per compaction for each granule.
I think this should be bounded but also we should probably recycle go-routine since those can grow pretty large in term of memory
I suggest we create 8 go-routines that will take care of compactions, then send granule to compact via a buffered channel of 32, meaning it can block on the write path.
The text was updated successfully, but these errors were encountered: