<font size="2"><span style="background-color:rgba(255,255,255,0)">Thank you Michael. Very appreciated details. </span></font><div><font size="2"><span style="background-color:rgba(255,255,255,0)"><br></span></font></div><div><font size="2"><span style="background-color:rgba(255,255,255,0)">Frank.</span></font></div><br>Le Friday, October 28, 2016, Michael Truog <<a href="mailto:mjtruog@gmail.com">mjtruog@gmail.com</a>> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Binaries are the only Erlang data type
that is reference counted, so you either would be sticking with
Erlang binaries in Erlang source code, or handling the data in a
NIF or port driver to get quicker lookup times. However, Erlang's
main advantage is the fault-tolerance features and you sabotage
that with potentially unstable NIFs or port drivers, so it is best
to keep your usage in Erlang source code.<br>
<br>
The other things to think about, is if you can use less data or
less readers, just as a basic change (probably an algorithmic
change). The general approach that avoids changing the design is
grouping the binaries into larger binaries though, as was
suggested.<br>
<br>
Best Regards,<br>
Michael<br>
<br>
On 10/27/2016 09:13 PM, Frank Muller wrote:<br>
</div>
<blockquote type="cite">Michael,
<div><br>
</div>
<div>Thank you for sharing "blookup". I'll look at it today. </div>
<div><br>
</div>
<div>Any other ideas to minimise the overhead when sharing large
Bins? I'm ok with changing the overall program design if
necessary.<span></span></div>
<div><br>
</div>
<div>Frank.<br>
<br>
Le Friday, October 28, 2016, Michael Truog <<a href="javascript:_e(%7B%7D,'cvml','mjtruog@gmail.com');" target="_blank">mjtruog@gmail.com</a>>
a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>You could use something like <a href="https://github.com/okeuday/blookup/" target="_blank">https://github.com/okeuday/blo<wbr>okup/</a>
to make larger binaries, but ideally you don't have to
(since it makes the lookups slow). This would be the
concept of grouping keys and values together, putting them
into various buckets, to decrease the ETS usage but
increase the binary size.<br>
<br>
On 10/27/2016 03:25 PM, Tony Rogvall wrote:<br>
</div>
<blockquote type="cite">
<pre>Simple, you may your 512 byte memory chunks bigger :-)
/Tony
</pre>
<blockquote type="cite">
<pre>On 27 okt 2016, at 23:24, Frank Muller <a><frank.muller.erl@gmail.com></a> wrote:
Tony,
Wow, 48-bytes is a huge overhead as N ~= 1000, and Every reader reads a binary 10x times or so per second.
Can anyone please suggest a better strategy to efficiently share them with a lesser overhead?
Frank.
Le Thursday, October 27, 2016, Tony Rogvall <a><tony@rogvall.se></a> a écrit :
1. A reference.
It will however build a 6-word structure called ProcBin on the heap for every binary reference that you read.
On a 64 bit machine that will lead to a 48 byte overhead. Nearly 10%.
/Tony
</pre>
<blockquote type="cite">
<pre>On 27 okt 2016, at 20:47, Frank Muller <a><frank.muller.erl@gmail.com></a> wrote:
Hi guys
Suppose an ETS table with only 1 writer and N readers
This table contains only large binaries (>64B) with the same size 512B exactly.
The single writer update these Bins once a while.
The N readers regularly read one of these Bins, but never change/update them.
Questions: what a reader gets when reading a Bin from this ETS table:
1. a reference to that Bin
2. or a full copy of that Bin
Hope someone can clarify this (with an example).
Thank you
Frank
______________________________<wbr>_________________
erlang-questions mailing list
<a>erlang-questions@erlang.org</a>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a>
</pre>
</blockquote>
</blockquote>
<br>
<fieldset></fieldset>
<br>
<pre>______________________________<wbr>_________________
erlang-questions mailing list
<a>erlang-questions@erlang.org</a>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a>
</pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>