brave / brave/adblock-rust

Better concurrency support

Open
#390 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
2.8k
Forks
250
Avg merge
1d 16h
Merged PRs (30d)
6

Description

Hello,
I want to use adblock-rust in a setup where concurrency would be beneficial. Although disabling `object-pooling` and `unsync-regex-caching` is enough to make `Engine` `Send + Sync`, there is still work to be done to actually make concurrent usage efficient. Hence, I want to contribute towards this goal, here is what I'm planing to do:
- Use a thread-local variable for the `request_tokens` vector
- I believe this solution might even outperform the object pooling implementation, and hence eliminate the need for the `lifeguard` dependency
- Use a concurrent cache rather than a mutexed hashmap
- While I have not used any concurrent cache other than redis (`dashmap` doesn't count as it doesn't have eviction support) in previous projects, after a bit of research, `mini-moka` (https://crates.io/crates/mini-moka) in particular caught my attention, since it has all the features we need while also providing a non-thread-safe implementation for the single-threaded case, so there can be high code reuse, while also being the sibling of `moka` which is battle-tested in production on crates.io itself

Please let me know your thoughts

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing Engine's request_tokens handling, object-pooling, unsync-regex-caching, and the mutexed hashmap mentioned in the issue. The proposed direction is thread-local request-token storage and a concurrent cache, but the issue does not define acceptance criteria, specific files, or tests; confirmation of the design would be needed before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.