[erlang-questions] Making erlang more realtime?

Vans S <>
Thu Mar 2 22:31:54 CET 2017


> Erlang is not a realtime platform, i.e. it does not give you millisecond/microsecond guarantees. It is soft realtime, which guarantees that your code will eventually  and periodically get CPU time with some +/- 100 ms precision > depending on the current load.

This was my misunderstanding. I thought Erlang guaranteed each process gets a 1ms (+/- 1) timeslice aka 2000 reductions and everything executes as realtime as possible to 1 millisecond.

And your #2 and #3, I already wiped up a test case in C and it seems il have to use Erlang as the auth/user management with more realtime app to handle the actual streaming.  Even caching the frames, with Erlang It seems I am getting similar realtime performance degradation just doing message passing and netio. 

    On Thursday, March 2, 2017 3:27 PM, Dmytro Lytovchenko <> wrote:
 

 Making it "more realtime" has little sense, as it is not realtime platform and never was, and never intended to be.

A few points to consider.1. Erlang is not a realtime platform, i.e. it does not give you millisecond/microsecond guarantees. It is soft realtime, which guarantees that your code will eventually  and periodically get CPU time with some +/- 100 ms precision depending on the current load.
2. If you want such millisecond precision you could write the critical decoding/feeding part in native code with an appropriate tool such as C/C++/Rust/Ocaml/Java/C# etc while Erlang will do the rest of the management and orchestration in your system.
3. One more way would be to let Erlang decode video ahead of time, so that you have few frames ready and cached for such a hiccup moment. Then even if some frame is late, there is always another frame ready to cover for it. Then let video player smooth the hiccups. I think streaming services do this at the cost of significant caching ahead.
2017-03-02 21:17 GMT+01:00 Vans S <>:

I currently need to stream 60 frames per second of video and I made a simple test case using erlang.

I have 1 gen_server doing a erlang:send_after every 17ms, when the handle_info procs it calls

os:perf_counter(1000) then compares the last time to the current, if the difference is > 20,
print to console.

Iv noticed that about every 2-3 seconds, the send_after arrives around in 20-23ms, this is not
respecting the millisecond realtime nature that I thought Erlang can provide.

Is there any VM arguments that could be passed to increase the realtime properties or other
things that can be done?

The testcase is just a naked rebar app with 1 gen_server not doing anything else.
______________________________ _________________
erlang-questions mailing list

http://erlang.org/mailman/ listinfo/erlang-questions




   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170302/22cf7839/attachment-0001.html>


More information about the erlang-questions mailing list