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

Stephen Han kruegger@REDACTED
Tue Oct 26 19:13:00 CEST 2004


Hi 

I may be confused, but even if you have single process manages the
configuration data and multiple processes retrieve the configuration
data from that single process using message passing, won't you still
have local copy of the data that needs to be garbage-collected?

regards,


On Tue, 26 Oct 2004 11:20:30 +0200, Lennart Öhman <lennart.ohman@REDACTED> wrote:
>  
>  
> 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   : lennart.ohman@REDACTED 
> 
>  ________________________________
>  Från: owner-erlang-questions@REDACTED genom Heinrich Venter
> Skickat: ti 2004-10-26 10:48
> Till: erlang-questions@REDACTED
> Ämne: How to get configuration data to a large number of threads?
> 
>  
> 
>  
> 
> 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
> 
>  
> 
> 
>  
> 
>



More information about the erlang-questions mailing list