Skip to content
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

Shared lock access when reading metadata during scans is slow #2382

Closed
benjaminwinger opened this issue Nov 9, 2023 · 3 comments
Closed

Comments

@benjaminwinger
Copy link
Collaborator

A major performance issue with #2304 is reading metadata too frequently, and while the number of calls is the main issue (fortunately easily resolvable), roughly 75% of the overhead is just from locking, despite the high cost being observed in read-only scans where nothing should be locking it for writing (removing the lock sped up one test from ~300ms to ~70ms).
There are probably more efficient lock implementations we can use.

@ray6080
Copy link
Contributor

ray6080 commented Nov 9, 2023

Optimistic locks should work here. I would give a try on that first. This perhaps can be optimized together with changes to the hash index.

@benjaminwinger
Copy link
Collaborator Author

The cost was vastly reduced (down to 0.05% of the new, much lower runtime) by removing the extra calls (from multiple metadata reads per string to one per call to Column::scan, i.e. one per 2048 values). I suspect that there is enough contention in the locks that having many threads trying to acquire even the shared lock very frequently slowed things down a lot.

@Riolku
Copy link
Contributor

Riolku commented Nov 9, 2023

Temporary plan is to keep the existing code. It doesnt seem like there are other RwLock implementations out there (aside from maybe boost?) and we can probably find better ways to get speed improvements than shooting ourselves in the foot with more complex concurrency.

@Riolku Riolku closed this as completed Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants