Erlang Process Performance Optimization

In the test I'm creating here, my goal is to create a parser. Therefore, I built a conceptual proof that reads all messages from a file, and after pressing all of them into memory, I create one process for parsing each message. So far, everything will be fine, and I have good results. But I could see that erlang VM does not use all my processor power (I have a quad-core processor), in fact it uses about 25% of my processor when performing my test. I did a counter test using C ++ that uses four threads and obviously uses 100%, which gives a better result (I respected the same queue model that erlang used).

So, I am wondering what could be "slowing down" my erlang test? I know this is not a serialization issue, as I create one process for each message. I thought that maybe my message is too small (about 10 thousand each), so most of the processes do not help to achieve excellent performance.

Some facts about the test:

106 thousand messages On erlang (25% processor power is used) - 204 ms On my C ++ test (100% processor is used) - 80 ms

Yes, the difference is not that big, but if there is more power, of course, there is more room for improvement, right?

And, I did some profiling and could not find another optimization method, since there are several function calls, and most of them are converting objects to objects.

Update:

Woooow! , 35 80 ++! !

+3
3

, erlang VM .

:

erl -smp enable +S 4

-smp , Erlang SMP + S 4 4 Erlang (1 )

, SMP :

Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
1> 

[smp: 2: 2] , smp 2 2 schesulers

+4

, "", , . FAR , , , . , .

- , . , , , , ( , , X, ),

- ++ vs Erlang -

Erlang ​​ , . . , , , ++, . (CPU/memory/OS/ ) .

+2

:

erlang:system_flag(scheduler_bind_type, processor_spread).
+2

Source: https://habr.com/ru/post/1727170/


All Articles