SV: How to get configuration data to a large number of threads?

Lennart Öhman <>
Tue Oct 26 11:20:30 CEST 2004


Hi,
my first thought was placing it in an ETS table, as you
suggested. In that way it is changable and accessable for
all processes.
 
If you retrieve it to make some calculations and then
only use the result, the retrieved data will eventually be
garbage collected away from the process, is that is not
satisfactory? I can imagine a situation where several
(thousands of) processes have copies (of the same data)
which sits and waits to be garbage-collected. It will of
course take up space until it is GC:ed. And the fact that
it sits and can be GC:ed in one process does not help you
if another process is the one causing your memory to run out.
 
Next idea: Can you make calculations on the data in
one single process, passing request-reply to/from that
process? (This will prevent you from having simultaneous
copies of the the same data in several processes waiting
for it to be garbage collected).
 
 
Best Regards,
Lennar
 
 
 
-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjöland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : 

________________________________

Från:  genom Heinrich Venter
Skickat: ti 2004-10-26 10:48
Till: 
Ämne: How to get configuration data to a large number of threads?


  <http://asp1.rocketseed.com/RocketSeed/mail/433a32353a3733353731353a33303639373a2d323a313933> 
  <http://asp1.rocketseed.com/RocketSeed/mail/433a32353a3733353731353a33303639373a2d323a313836>  

Hello all

I need a bit of advice. I have a transaction based system that spawns a
thread to handle every incoming transaction. Unfortunately there is
quite a large chunk of relatively static configuration information that
is needed by every thread.
With relatively static I mean that it is changeable through user
intervention at any time.

The question is, how do I get this information to every thread without
signifficantly slowing things down or using up all the available memory?

I am not sure, but I suspect passing it as a parameter will cause
thousands of copies to be made. Is this correct?
I was thinking of making a globally registered ets table, but this will
cause copies to be made again once it is read from the table.
The last option might be to declare all the information in a hrl file,
but then changing the configuration would require recompilation.
As I understand, using a binary formated chunk of data will prevent
copying, but when converting back to a more usable format the data will
be copied again.

Any other ways of getting large chunks of configuration data quickly to
a large number of transient threads?

Help and advice appreciated.

-]-[einrich Venter



<http://www.rocketseed.com/discstart.html> 


<http://www.rocketseed.com/discend.html> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20041026/87d85c69/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MTk2LjMwLjc5LjE1NQ==
Type: image/gif
Size: 19652 bytes
Desc: MTk2LjMwLjc5LjE1NQ==
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20041026/87d85c69/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MTk2LjMwLjc5LjE1NQ==
Type: image/gif
Size: 556 bytes
Desc: MTk2LjMwLjc5LjE1NQ==
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20041026/87d85c69/attachment-0001.gif>


More information about the erlang-questions mailing list