derekkraan / horde

Horde is a distributed Supervisor and Registry backed by DeltaCrdt
MIT License
1.32k stars 106 forks source link

Implement ETS's as DynamicSupervisor internal data structures instead of Maps #222

Closed dbuos closed 3 years ago

dbuos commented 3 years ago

Hi, I've been using horde, in a project where I need a huge number of processes been supervised and distributed across nodes, when this number increase I note some performance degradation.. One of my guess when I inspected the DynamicSupervisorImpl were that maybe changing the maps processes_by_id and process_pid_to_id for an ETS, could have a positive effect in the performance..

Of course after the modifications, and do some tests, this change shows a improvement in the performance of spawning new childs in the supervisor, some numbers:

image image

I tried to keep this change as local as posible thus not modifying anything outside this internal implementation detail.

I Hope this could help to enhance a bit this fantastic library.

derekkraan commented 3 years ago

Hi @dbuos thanks for the PR. Can you help me understand why this is faster than just using bare maps?

dbuos commented 3 years ago

Hi @dbuos thanks for the PR. Can you help me understand why this is faster than just using bare maps?

Hi @derekkraan, I don't have all the specific implementation details of Erlang ETS's but I've observed that:

derekkraan commented 3 years ago

Merged, this looks great, thanks for the PR @dbuos