Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello!

Currently working on a document processor that reads most of a directory into memory, parses the files there-hidden, and then dumps the resultant data to several different files on disc ( the reason is obscure and distressing)

I have found however that the log file writes, given they are going to several different files (and at some point soon probably over network shares) are becoming a bottleneck, which is an issue given there are about 800k 1 MB~ files to do on a more than daily basis. (waiting for the DBA to get on with it)

Therefore I would like to store some quantity of the output into memory until a limit is reached, then dump them to disc. viz:

<<loop>> { if ($hashmatch{$scrutiny}){ $$bufmem = $$bufmem . "<<secret parsing output goes here!>>\n"; if (length($$bufmem) > 1024){ print("buffer dump\n"); $outfh->print($$bufmem); $$bufmem = ""; } } } $outfh->print($$bufmem);
I am sure there is a better/more portable way of doing this though, but I can't seem to describe it to the search engine daemons so as to get the right sort of answer. can anyone describe/direct or otherwise enlighten me in this regard?

yrs,

TR


In reply to temp hold logfiles in memory? by TRoderic

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-26 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found