Closed chouzar closed 1 month ago
This is expected, yes. It's intended that you have a low number of handlers, similar to Erlang's receive
expressions having a low number of clauses.
receive
likely performs better with hundreds of thousands of clauses than a selector does, but unfortunately we don't have a way to generate receive
expressions at runtime or in a type safe manner other than thought the selector abstraction.
Appreciated! ✨
likely performs better with hundreds of thousands of clauses
I do recall doing some tests with maps and clauses and the performance also had issues with very big maps.
This is expected, yes. It's intended that you have a low number of handlers ...
Got it! Either I will design with this limitation in mind or try to find a workaround.
Will close this issue. Thank you so much!
After working more on the benchmark itself, it seems that the problem was the way I was queuing up messages in the actor (a large 5000+ message queue would make it very slow for some reason), by throttling the messages I'm able to get decent response times for an in-memory store:
Name ips average deviation median 99th %
chip.find 462.84 K 2.16 μs ±433.02% 1.96 μs 4.58 μs
Still I will benchmark against an alternative, use the select anything helper to not have to build up the selector, but also, to not keep it in memory.
While trying to do some stress tests to my registry library chip I started to notice big slowdowns when the registry goes into the
100_000
monitored subjects mark; basic calls to the registry actor will start to fail due to timeouts.To work chip builds its selector in-memory each time a new subject is registered, I tried to come up with the simplest example to test:
When running the code above I'm trying to spawn
100_000
subjects so they can be monitored, then I just try to retrieve the actor's "value" which is always0
non-changing through a normal call. These messages that are printed into the console:Incrementing the timeout to very big numbers like
10_000_000
will eventually return, but this is of course not ideal. I will try to look for other alternatives for building the selector but was wondering if there were any pointers into the behaviour of the actor, is this a design bug?