<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1487736277493_706813" dir="ltr">> <span style="font-family: "Helvetica Neue", "Segoe UI", Helvetica, Arial, "Lucida Grande", sans-serif; font-size: 13px;" id="yui_3_16_0_ym19_1_1487736277493_706834">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 </span></div><div id="yui_3_16_0_ym19_1_1487736277493_706813" dir="ltr"><span style="font-family: "Helvetica Neue", "Segoe UI", Helvetica, Arial, "Lucida Grande", sans-serif; font-size: 13px;" id="yui_3_16_0_ym19_1_1487736277493_706892">> depending on the current load.<br><br>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.<br><br>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.</span></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Thursday, March 2, 2017 3:27 PM, Dmytro Lytovchenko <dmytro.lytovchenko@gmail.com> wrote:<br></font></div>  <br><br> <div class="y_msg_container"><div id="yiv5934254649"><div><div dir="ltr"><div>Making it "more realtime" has little sense, as it is not realtime platform and never was, and never intended to be.<br clear="none"></div><div><br clear="none"></div>A few points to consider.<div>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.</div><div><br clear="none"></div><div>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.</div><div><br clear="none"></div><div>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.</div></div><div class="yiv5934254649gmail_extra"><br clear="none"><div class="yiv5934254649yqt1469853357" id="yiv5934254649yqtfd17332"><div class="yiv5934254649gmail_quote">2017-03-02 21:17 GMT+01:00 Vans S <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:vans_163@yahoo.com" target="_blank" href="mailto:vans_163@yahoo.com">vans_163@yahoo.com</a>></span>:<br clear="none"><blockquote class="yiv5934254649gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I currently need to stream 60 frames per second of video and I made a simple test case using erlang.<br clear="none">
<br clear="none">
I have 1 gen_server doing a erlang:send_after every 17ms, when the handle_info procs it calls<br clear="none">
<br clear="none">
os:perf_counter(1000) then compares the last time to the current, if the difference is > 20,<br clear="none">
print to console.<br clear="none">
<br clear="none">
Iv noticed that about every 2-3 seconds, the send_after arrives around in 20-23ms, this is not<br clear="none">
respecting the millisecond realtime nature that I thought Erlang can provide.<br clear="none">
<br clear="none">
Is there any VM arguments that could be passed to increase the realtime properties or other<br clear="none">
things that can be done?<br clear="none">
<br clear="none">
The testcase is just a naked rebar app with 1 gen_server not doing anything else.<br clear="none">
______________________________ _________________<br clear="none">
erlang-questions mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:erlang-questions@erlang.org" target="_blank" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/ listinfo/erlang-questions</a><br clear="none">
</blockquote></div><br clear="none"></div></div></div></div><br><br></div>  </div> </div>  </div></div></body></html>