Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re:^2 How to share huge data structure between threads?

by ph0enix (Friar)
on Jan 13, 2003 at 08:49 UTC ( [id://226417]=note: print w/replies, xml ) Need Help??


in reply to Re: How to share huge data structure between threads?
in thread How to share huge data structure between threads?

 Well, you don't say how big huge is, so...

Server I'm testing on have 3GB RAM which will be probably insufficient for final application. Current size of the test data I want to share is about 600MB (after loading to perl). I don't think that IPC::Shareable can fit this requirements.

  • Comment on Re:^2 How to share huge data structure between threads?

Replies are listed 'Best First'.
Re: Re:^2 How to share huge data structure between threads?
by BrowserUk (Patriarch) on Jan 15, 2003 at 06:56 UTC

    One thought. If your reluctant to move to using a file-based data sharing option (like Tie::DBI or other) because of speed, you might consider creating a Ramdisk and placing the tied file on there.


    Examine what is said, not who speaks.

    The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Re:^3 How to share huge data structure between threads?
by LogicalChaos (Beadle) on Jan 15, 2003 at 05:59 UTC
    OUCH... Seems like a real dB is the only way to go? What sort of performance are you needing? Do you have large quantities of keys or data associated with the keys?

    Have you seen Tie::DBI? I've not used it, but it appears interesting, and might be a quick fit to your application.

    Please post your eventual solution back to this thread, as I'm curious what you come up with.

    Luck,
    Chaos

      Tie::DBI is a memory pig and I wouldn't recomend it for Phoenix's problem. In fact, I'm not happy with this whole tie() idea to begin with for this case. In some previous threads on the same problem Phoenix had some other problems where ze was running out of memory. I'm tending to think ze should either use the straight DB APIs straight - without going through tie() or MLDBM shenanigans.

      In fact... I was thinking of something like Pg (not DBD::Pg) combined with either asynchronous queries or cursors might be a good comprimise.

      This should be some kind od dictionary. As I wrotte in my original post. Data structure of stored value is hash of array of objects.

      Currently only working solution is Tie::RDBM with PostgreSQL database backend. Trying to save data in memory I can't share whole hash which contain values as I described before. Because all server threads must be able to add / delete / modify this data I'm currently looking on solutions based on Tie::RDBM + PostgreSQL and MLDBM + BerkeleyDB. When BerkeleyDB with MLDBM is used I get some strange errors probably originaly from Storable module - 'inbalid byte order', 'wrong signature' or 'bad data'...

      Other problem I have with tied hashes and Storable (not solved yet) was described in node Storable: where is my memory?.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://226417]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-06-20 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.