Skip to content

Conversation

@YannayJaffe
Copy link

This PR prevents false sharing between writing to key_gen_ and reading any of the index members (as well as invoking virtual methods).
I noticed a performance hit in rubis benchmark with many threads. I saw a very long time_commit value (when enabled the performance measurements). Perf pointed me to reading the virtual table of ordered_index. The reason was that some transactions were in the process of committing (and invoking virtual methods of ordered_index), while other transactions were incrementing the key_gen_ member.
The best solution would be to also prevent writing to the same memory location by many threads as it causes contention, but this PR improves current things with minimal changes.
I noticed a huge improvement (in the order of 2x) when running rubis with 64 threads after this change

Prevents false sharing when one thread writes to key_gen_ and others read other class members (that reside on the same cache line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant