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

feat: driver high-water marks #13

Open
merklefruit opened this issue Oct 19, 2023 · 2 comments
Open

feat: driver high-water marks #13

merklefruit opened this issue Oct 19, 2023 · 2 comments
Labels
A-socket Area: Sockets C-feature Category: Feature
Milestone

Comments

@merklefruit
Copy link
Contributor

merklefruit commented Oct 19, 2023

The current req and pub driver have infinite capacity. This means that if for some reason messages accumulate in the pending requests queue, the application will eventually run out of memory and crash.

  • example in req driver:

// Check for outgoing messages from the socket handle
match this.from_socket.poll_recv(cx) {
Poll::Ready(Some(Command::Send { message, response })) => {
// Queue the message for sending
let start = std::time::Instant::now();
let msg = this.new_message(message);
let id = msg.id();
this.egress_queue.push_back(msg);
this.pending_requests.insert(
id,
PendingRequest {
start,
sender: response,
},

We should add some sort of HWM that either blocks or drops messages after a specific capacity is reached.

An option could be to use LruCache instead of the current FxHashMap.
Further improvements include different StorageBackends including layered cache between memory and disk (e.g. LruCache -> RocksDB)


Edit:

  • See conversation in Pubsub v1 #9 (comment)
  • On the subscriber level, a durability Policy settings should be added to indicate if we intend to receive cached messages or just the ones send from the connection point onward.
@merklefruit merklefruit added C-feature Category: Feature A-socket Area: Sockets labels Oct 19, 2023
@merklefruit merklefruit changed the title feat: req high-water marks feat: driver high-water marks Oct 19, 2023
@mempirate mempirate added this to the v0.1.1-alpha milestone Oct 19, 2023
This was referenced Oct 19, 2023
@quangkeu95
Copy link
Contributor

quangkeu95 commented Nov 10, 2023

Did anyone start working on this?

@merklefruit
Copy link
Contributor Author

Hey @quangkeu95 there's one open PR (#29) that is adding throughput limits which is already something in this direction.
Maybe after that's done we can reevaluate! Thanks for the interest

@mempirate mempirate modified the milestones: v0.1.1-alpha, v0.1.2-alpha Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-socket Area: Sockets C-feature Category: Feature
Projects
None yet
Development

No branches or pull requests

3 participants