-
Notifications
You must be signed in to change notification settings - Fork 14
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
use RWMutex replace Mutex in segment #16
use RWMutex replace Mutex in segment #16
Conversation
I have 2 concerns with this approach:
I don't see how this can work either. |
To me, compression chunks of stored documents is great for compression, but terrible for our existing search API, and without changes to that, it cannot perform well. |
We can reduce the scale of lock, when load data we can initial many mutex equal to thunk num, but we don't cache uncompress data. We still cache uncompress data when first use it. After then, we split the lock contention to 1/N (n=thunkNum) Fake code:
|
I guess I misunderstood what you were doing here. Don't you still think this is going to cache too much data? |
It going will be to add a cache manager to keep memory usage at a proper size. |
You're saying in order for this to work well, we need some other component that doesn't exist yet? |
Yes, you are right, let me think more, try to find other solution. |
var storedFieldDecompressed []byte | ||
var ok bool | ||
if storedFieldDecompressed, ok = s.decompressedStoredFieldChunks[chunkI]; !ok { | ||
storedFieldDecompressed := s.decompressedStoredFieldChunks[chunkI] |
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.
I don't think we ever actually succeed in updating items inside the map. Although you mutate storedFieldDecompressed
I believe this is a copy, not the item the map. See this example I think is analagous: https://go.dev/play/p/s0UrS7nD_fg
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.
Yeah, you are right, i changed it. 34f03d6
This will be slight, but it would cause problem when load many many segments, need a mechanism to release unused cache.