Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Benign Web Miner

by BrowserUk (Patriarch)
on Sep 30, 2006 at 18:08 UTC ( [id://575689]=note: print w/replies, xml ) Need Help??


in reply to Benign Web Miner

Sharing large volumes of data between threads, whether through threads::shared or tools (like Thread::Queue) that use the former, is simple not effective. It is a penalty of the ithread architecture that even if you only want to share data between 2 individual threads, every other thread in the process also gets a copy like it or not, use it or not.

On the face of it, two simple changes to your Win32 threaded code might sort the problems out.

  1. Have each thread retrieve the data from the url to an in-memory, *non-shared* buffer, and use a single semaphore (ie. a shared scalar) and threads::shared::lock() to ensure that only one thread writes to disk at a time.
  2. Create yourself a tperl.exe with a greatly reduce stacksize reservation as described in Use more threads.. With this reduced to 64k, you should find you are able to run many, many more concurrent threads.

    I've had 3000 ithreads running and concurrently active, though they were not doing much at all. I would suggest that 100 or 200 would probably be enough to ensure that you are capable of using the full bandwidth available from your internet connection. Of course, the limitations are likely to be memory in which to hold the data prior to writing it to disc, rather than connection speed.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-16 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found