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

[Dev]: Locking Avoidance #64

Open
TylerBloom opened this issue Mar 2, 2023 · 0 comments
Open

[Dev]: Locking Avoidance #64

TylerBloom opened this issue Mar 2, 2023 · 0 comments
Labels
todo Will be resolved but work hasn't started

Comments

@TylerBloom
Copy link
Member

Unmet Need:

Currently, multiple locks need to be taken out to process almost any request. What's worse is that these locks are implemented as spin locks. While this works, we can do much better and make SB fully lock-free and spin-free.

Solution:

Currently, every command needs to take 2-3 locks. In part, these locks are to avoid deadlock due to DashMap. Instead, we can use a message-passing.

To implement this, ownership (and direct access) to tournament data will be moved from a command's context into a separate tokio task. This task can be sent messages via an MSPC channel. Because a single process will own and manipulate the tournament data, no locks are required.

Challenges/Considerations:

This will be a fairly large refactoring. Because most of the data processing will happen in a single task, tournament methods need to await need to be refactored nothing is awaited in this task. This will likely require spawning tasks with additional channels for intra-task communication.

@TylerBloom TylerBloom added the todo Will be resolved but work hasn't started label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
todo Will be resolved but work hasn't started
Projects
None yet
Development

No branches or pull requests

1 participant