Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Counter - number of tags per interval

by sundialsvc4 (Abbot)
on May 04, 2013 at 20:31 UTC ( #1032081=note: print w/replies, xml ) Need Help??

in reply to Re: Counter - number of tags per interval
in thread Counter - number of tags per interval

This process would also benefit from being run, say, in a cluster.   If your program accepted as parameters the starting and ending line-numbers that it is to process, then multiple independent instances of the same process, running on different machines, could each summarize a chunk of the file, doing it in the manner just suggested:

  1. Tally all of the unique values that occur in the chunk, with the number of times that they occur.
  2. Process the ranges-file once, totaling the value-counts found within that range.
  3. Output a file that can be merged with all the other cluster outputs once all the cluster instances have finished doing their job.

The last step will be a “classic merge,” because you know that each process read the ranges-file sequentially, and that it output either zero or one record for each range, in that order.   Thus, the merge process (which generates an output that can also if need be be used as its input ...) might go something like this:

  1. Open the ranges-file and n not-yet-processed input files (including output of the last iteration of this program, if need be).
  2. “Prime the pump” by reading the first record from each input other than the ranges-file.
  3. Now, iterate through the ranges-file.   For each range, examine all of the input-files which are not yet empty to see if they have a count for that range.   If so, add it to the total and read the next record (if any) from that file.   If no files contain the range, the answer for that range is zero.   Continue until the ranges-file is exhausted.
Once again, merging is a purely-sequential process, and if there are many files to process they can be processed in stages by using the output of one stage as an input to the next iteration.

Run as many instances as you can, provided that each instance never exhausts the amount of real, not virtual, memory that is available in the machine for it.   Each instance reads each file sequentially.   All of the tallying and range-comparison should occur entirely in memory and should make maximum use of memory as an “instantaneous file.”   Each process should exhibit a large working-set size but no page-outs.

  • Comment on Re^2: Counter - number of tags per interval

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032081]
and John Coltrane plays...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-01-21 05:48 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (182 votes). Check out past polls.