hollywood icon indicating copy to clipboard operation
hollywood copied to clipboard

Bench results - hollywood slower than golang channels

Open andreaugustoaragao opened this issue 1 year ago • 1 comments

I have written a benchmark to compare using hollywood to using go channels.

The benchmark can be found here: https://github.com/andreaugustoaragao/bench_actors/blob/main/actors_test.go

I don't know if I'm doing something wrong but the version using channels is consistently faster than the version using hollywood except if I introduce a small delay in the actor function processing, in which case, the hollywood version is slightly faster.

I have also added mpsc (https://pkg.go.dev/github.com/AsynkronIT/protoactor-go/internal/queue/mpsc#Queue) as someone mentioned in one of @anthdm videos it was 20x faster than using channels.

Results with configuration: NUMBER_OF_ITEMS = 16384 NUMBER_OF_ACTORS = 8 QUEUE_SIZE = 128

image

Results with configuration: NUMBER_OF_ITEMS = 16384000 NUMBER_OF_ACTORS = 8 QUEUE_SIZE = 128
image

When the number of items is significant larger, the memory utilization of both hollywood and mpsc reach 2GB, whereas channels never go beyond 100MB. MPSC doesn't have a queue limit so I'm not surprised to see memory growing up significantly.

Hollywood though does have a setting, but it seems it's not being applied given what I'm observing.

andreaugustoaragao avatar Jan 16 '24 00:01 andreaugustoaragao

@andreaugustoaragao Interesting stuff. I will take a look at this. Thanks for the investigation!

anthdm avatar Jan 16 '24 13:01 anthdm

Maybe I'm missing something here, but isn't it obvious that channels would be faster than Hollywood? Channels are native to the language, whereas Hollywood will have to marshall/unmarshall the payload and go through the network.

Channels don't have the ability to cross the wire. If one wants actor semantics but doesn't need network transparency there is always github.com/perbu/Bolllywood, which is a toy Actor implementation on top of channels.

perbu avatar Oct 12 '24 11:10 perbu