<div dir="ltr"><div>Thank you for your time</div><div>and insightful explanations!</div><div><br></div><div>Bogdan<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 16, 2021 at 11:48 AM Lukas Larsson <<a href="mailto:lukas@erlang.org">lukas@erlang.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 16, 2021 at 10:30 AM Bogdan Andu <<a href="mailto:bog495@gmail.com" target="_blank">bog495@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Great,<br><br>I have the following:<br><br>2> erlang:system_info(check_io).<br>[[{name,erts_poll},<br>  {primary,poll},<br> <b> {kernel_poll,false},</b><br>  {memory_size,12920},<br>  {total_poll_set_size,2},<br>  {lazy_updates,true},<br>  {pending_updates,0},<br>  {batch_updates,false},<br>  {concurrent_updates,false},<br>  {fallback,true},<br>  {max_fds,512},<br>  {active_fds,0},<br>  {poll_threads,0}],<br> [{name,erts_poll},<br>  {primary,kqueue},<br>  <b>{kernel_poll,kqueue},</b><br>  {memory_size,56},<br>  {total_poll_set_size,1},<br>  {lazy_updates,false},<br>  {pending_updates,0},                                                                                                                                                                       <br>  {batch_updates,false},                                                                                                                                                                     <br>  {concurrent_updates,true},                                                                                                                                                                 <br>  {fallback,false},                                                                                                                                                                          <br>  {max_fds,512},                                                                                                                                                                             <br>  {active_fds,0},                                                                                                                                                                            <br>  {poll_threads,0}],                                                                                                                                                                         <br> [{name,erts_poll},<br>  {primary,kqueue},<br>  <b>{kernel_poll,kqueue},</b><br>  {memory_size,28728},<br>  {total_poll_set_size,1},<br>  {lazy_updates,false},<br>  {pending_updates,0},<br>  {batch_updates,false},<br>  {concurrent_updates,true},<br>  {fallback,false},<br>  {max_fds,512},<br>  {active_fds,0},<br>  {poll_threads,1}]]<br><div>3></div><div><br></div><div>What means <b>{kernel_poll,false}</b> ?</div><div>That poll is not used and kqueue it is used?</div><div><br></div><div>Why are three poll entries and why one kernel-poll kqueue entry has<br></div><div> memory_size 56 and the next has memory_size 28728? Which one is used by the emulator?</div></div></blockquote><div><br></div><div>Different OSs need different polling strategies, for OpenBSD (and others, I can't recall which) there are by default 3 pollsets used.</div><div><br></div><div>1) The first pollset is what is called the fallback pollset and it is used for any FD that cannot be polled by kqueue. I think that the stdin/stdout fds end up here and possibly some others.</div><div>2) The main pollset used by the poll-thread for most I/O polling. This is why this pollset is larger.</div><div>3) An optimized pollset where the read side of any fd that uses the `{active,true}` pattern is placed. Mainly this is used for distribution sockets, but works for any other fd as well that follows this pattern.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>And how can I customize the parameters like max_fds, total_poll_set_size, memory_size?</div></div></blockquote><div><br></div><div>Max fds is taken from `ulimit -n` of the current user. The other values are just statistics about the current usage.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>And how does these parameters impact the performance of busy erlang node like say, <br></div><div>very high traffic tcp/ip/ssl server?</div></div></blockquote><div><br></div><div>They don't. These values are meant for debugging the system, not optimizing it. If you are interested in optimizing you may want to read this blog post: <a href="https://www.erlang.org/blog/io-polling/" target="_blank">https://www.erlang.org/blog/io-polling/</a>.</div><div><br></div><div>However, from the I/O polling point of view things are quite optimal in the default setting. So I doubt that you can gain much by tweaking the different options available.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Thank you,<br></div><div><b></b></div></div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 16, 2021 at 11:07 AM Lukas Larsson <<a href="mailto:lukas@erlang.org" target="_blank">lukas@erlang.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>On Tue, Nov 16, 2021 at 9:59 AM Bogdan Andu <<a href="mailto:bog495@gmail.com" target="_blank">bog495@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Lukas,<br>
<br>
I didn't; find any documentation related to that.<br></blockquote><div><br></div><div>A pr improving the documentation would be much appreciated!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Anyway,<br>
<br>
$ erl<br>
Erlang/OTP 24 [erts-12.1.4] [source] [64-bit] [smp:4:4] [ds:4:4:10]<br>
[async-threads:1]<br>
<br>
Eshell V12.1.4  (abort with ^G)<br>
1> erlang:system_info(kernel_poll).<br>
true<br>
2><br>
<br>
I guess I have kernel poll support for my erlang servers.<br>
<br>
How can one tell if it is 'kqueue' or 'poll' type of kernel poll?<br>
<br>
Because OpenBSD has also poll which is not great<br>
<br>
Is there any erlang system information function that shows<br>
exactly that?<br></blockquote><div><br></div><div>If you run `erlang:system_info(check_io)` you will get information about the I/O checking sub-system which should include information about which mechanism is used.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thank you<br>
<br>
<br>
<br>
On Tue, Nov 16, 2021 at 10:53 AM Lukas Larsson <<a href="mailto:lukas@erlang.org" target="_blank">lukas@erlang.org</a>> wrote:<br>
><br>
> Hello!<br>
><br>
> The banner about kernel-poll was removed from the erlang start some releases ago. So to check if you have kernel poll support you need to call `erlang:system_info(kernel_poll)`. If it returns `true` then you have kernel-poll support.<br>
><br>
> Lukas<br>
><br>
> On Tue, Nov 16, 2021 at 9:47 AM Bogdan Andu <<a href="mailto:bog495@gmail.com" target="_blank">bog495@gmail.com</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> I have an OpenBSD 6.8 amd64 machine and<br>
>> I would like to compile Erlang 24 with kqueue support<br>
>> such that I want erl to show me this:<br>
>><br>
>> $erl<br>
>> ........................ [kernel-poll]<br>
>><br>
>> I understand that this is a compile time option<br>
>> and not anymore a runtime selectable option tru + K true<br>
>> switch<br>
>><br>
>> I tried the following configure options with no success:<br>
>> ./configure --prefix=/usr/local/erlang24.1.4<br>
>> --with-ssl=/usr/local/openssl/1.1.1l --enable-dynamic-ssl-lib<br>
>> --with-ssl-rpath=/usr/local/openssl/1.1.1l/lib --without-javac<br>
>> --enable-threads --enable-kernel-poll --disable-hipe<br>
>><br>
>> With openbsd patches (+./otp_build update_configure)<br>
>> and without patches the result is the same:<br>
>> no kernel-poll flag present - meaning that kernel polling with kqueue<br>
>> is not available to that erlang emulator.<br>
>><br>
>> Please advice me how to build erlang 24 with kqueue support.<br>
>><br>
>> I have an Openbsd 5.4 with erlang 19 that does has kernell-poll flag<br>
>><br>
>> $ erl +Ktrue<br>
>> Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:2:2]<br>
>> [async-threads:10] [kernel-poll:true]<br>
>><br>
>> Eshell V8.1  (abort with ^G)<br>
>><br>
>><br>
>> p.s.<br>
>> building erlang 24 against openssl 1.1.1 for tlsv3 support wasn't<br>
>> a pleasant experience. The configuration script links against<br>
>> system libressl  openssl library, instead of --with-ssl option given<br>
>> to ./configure.<br>
>> So I had to alter manually crypto ./configure and Makefile files .<br>
</blockquote></div></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>