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

Bench results - hollywood slower than golang channels #152

Open
andreaugustoaragao opened this issue Jan 16, 2024 · 2 comments
Open

Bench results - hollywood slower than golang channels #152

andreaugustoaragao opened this issue Jan 16, 2024 · 2 comments

Comments

@andreaugustoaragao
Copy link

andreaugustoaragao commented Jan 16, 2024

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.

@anthdm
Copy link
Owner

anthdm commented Jan 16, 2024

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

@perbu
Copy link
Collaborator

perbu commented Oct 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants