I am having a graph datastructure and i have vertices in graph.No of vertices are around 20K .Now I want to create a seperate actor for each node.this is because i want to perform some aggregations across nodes.
There is a master worker which reads and sends messages to worker at vertex.This worker than does some complex tasks.Hit db and stuff.
Is it ok to create so many actors?
If yes how many actors can be supported on a box with say 4 gb ram?
An Akka Actor occupies around 400-500 bytes, so theoretically you should be able to fit around 8.5 million on 4GB of heap, but there's always other things occupying heap and you definitely want to make sure you have available memory for messages and not having to have the GC running all the time.
My advise is that you only create 1 top-level actor (system.actorOf) and ideally you spread the children out so the tree is not super-flat (1 parent w 20k children is quite flat) but you can start out with that.
Cheers, √
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With