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.

In reply to Re: Benign Web Miner by BrowserUk
in thread Benign Web Miner by perlmonkey2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.