From: Armin ranjbar <[EMAIL PROTECTED]>
> im working on high performance dns server using perl , its nearly
> completed but i had some very urgent and bad looking problem , well , 
> im using single hash value to store all queries , for example 
> 
> $mhash{"kernel.org"}{"MX"} returns cached MX query of kernel.org , the
> problem is , the data is not cache-able across threads ( threads are
> making query ).
> 
> here is some solution and why i think they are not very usable ,
> please correct me 
> 
> 1 > using IPC::Shareable 
> very limited , i ran out of space for locks .
> 
> 2 > using threads::shared 
> looks like its unable to share second and third level of my %mhash . 
> 
> 3 > in memory databases using DB_file 
> just like threads::shared its unable to handle second and third level
> of my mhash .

What you could do is to have one thread act as the "bookkeeper", own 
and update the hash and all the other threads would ask it. Maybe 
using pipes or something.

So the work threads would not access the hash, but instead send a 
message to the bookkeeper who'd respond with the data or a message 
that the data are not cached. The worker thread would then either 
respond to the requestor or do the lookup, respond and send a message 
to the bookkeeper to store the mapping.

Do I make sense?

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to