tonarino / actor

A minimalist actor framework aiming for high performance and simplicity.
MIT License
40 stars 6 forks source link

Add an option for unbounded actor addresses #57

Closed bschwind closed 2 years ago

bschwind commented 3 years ago

In some cases we create actors with "large enough" buffers, like 500 or so. In these cases, instead of just guessing the capacity, it probably makes more sense to just use an unbounded channel. The 500 was essentially saying "we should have enough where it never reaches capacity", and I think using unbounded makes that distinction more clear.

mcginty commented 3 years ago

I'm kind of hesistant to support unbounded actor addresses, since it opens up the possibility for unbounded memory consumption and might lead to issues that are more difficult to track down compared to errors that can be caught within the binary.

bschwind commented 3 years ago

I don't share those same concerns. In the same way that crossbeam-channel provides unbounded and it's up to you to use it responsibly, why can't this crate provide the same?

The problem we want to solve is "This actor is not on the 'hot path' of my application. I want it to receive every message it gets sent, even if it takes a little longer or uses up some memory."

That's why we have some actors with an addr of Addr::with_capacity(500). It's kind of silly to just take a random guess at what that value should be if your intention is for it to never drop messages. I'm talking about actors which handle state/config changes which don't happen at a regular frequency but which may have some burstiness to it.

skywhale commented 2 years ago

@bschwind I'm closing this PR for now.