-
Notifications
You must be signed in to change notification settings - Fork 282
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
[Perf] Add Relationship Index Storing Caveat #1988
base: main
Are you sure you want to change the base?
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
This comment was marked as resolved.
This comment was marked as resolved.
908fd62
to
821f59b
Compare
internal/datastore/crdb/migrations/zz_migration.0007_add_relation_index_storing_caveat.go
Outdated
Show resolved
Hide resolved
I believe this PR was opened to address #1923 |
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 have concerns about this PR. The reason the issue was created in the first place is because the CRDB UI shows it as recommended. This is likely so that the query becomes served from the index, instead of having to go to disk to fetch the rest of the columns.
I have three concerns about the proposal:
- it drops the previous indexes. This means that until the new indexes are created, the system is left without an index. This has the potential to cause an incident on a production system, as it can push the database over saturation level.
- further increases the cost on the write path, as the system now has to write more information to disk, potentially making writes slower.
- increases the amount of storage needed. While it is reasonable to trade disk for query speed, customers running CRDB Dedicated can see their bill explode, as Cockroach Labs puts a hefty price tag on the disk capacity of their managed offerings.
I don't think we can move forward with this without:
- running a load test to assess how much queries improve and if it's worth the tradeoff
- determining the % increase in disk used
- finding a way to add those indexes without causing an incident (the easiest solution being to consider running 2 migrations, or exploring
ALTER
the indexes)
Yes, you're right, thanks. I forgot to add the description. |
I would try to work on the stress test to test the two metrics you mentioned. For the index drop and create issue, I have searched on that, (currently) it seems it is impossible to alter the standard index to the storing column index. |
I'm not entirely sure this would work either. There are some caveats:
This is unfortunately a difficult migration to run without some careful planning. E.g. we have customers with Terabytes worth of SpiceDB relationships in their Cockroach clusters. This migration would:
I'd like to see these optimizations make it into
Perhaps a conservative approach would be:
Would like to hear your thoughts on this issue @josephschorr |
spicedb/pkg/datastore/test/watch.go Lines 49 to 53 in d77601b
If I change tuple num to 512, then the test 256-true would pass, while its testing name would be 512-true
|
I think that's fine, the goal of the test is to push so many changes the consumer cannot retrieve them for the channel fast enough, a timeout will be triggered if the channel is at capacity, and if enough time elapses the channel Watch API connection will be aborted. Feel free to increase it, id say this is likely a flake. |
No description provided.