r/mit6824clojure • • Jul 04 '20

Map reduce questions

Feel free to ask questions about map reduce here. Lab & and lecture

3 Upvotes

3 comments sorted by

1

u/m_woodworth Jul 08 '20

For anybody who'se given this a shot - did you have to modify the time interval for monitoring if a worker is still active? The lab recommends 10 seconds, but I found that the mapping portion can take up to 15 for some of the larger files (reducing takes no time at all, so not an issue).

This might be related to the way I've structured the system, e.g. I only check-in with the master once a worker completes it's entire map task. I could instead check in while processing the map task at different intervals, but that adds quite a bit of overhead just to satisfy the 10 second constraint.

Also, the test script removes certain files in the "mr-tmp/" folder in between different test runs, so as not to mix the outputs from different test stages (e.g. to avoid combining the intermediate files from wordcount ones). The indexer test removes all files matching "mr-*", however after the indexer test both the parallel map and parallel reduce test only remove files matching the following patterns:

  • "mr-tmp/mr-worker*"

  • "mr-tmp/mr-out*"

I was using the format "mr-tmp/mr-[0-9]-[0-9]" for intermediate files, where the first [0-9] is the worker and the second is the reduce bucket that keys slot into. This meant I had to modify the test script to remove those files in between runs, otherwise the parallel map and parallel reduce tests would append to files created by the indexer test. I found this confusing since MIT's website says this:

  • "A reasonable naming convention for intermediate files is mr-X-Y, where X is the Map task number, and Y is the reduce task number."

But then the test script doesnt remove those files between runs (after the indexer portion).

1

u/TheLastSock Jul 08 '20

The master pinning the workers every couple seconds isn't that much overhead imo. The exact way you configure the fail over would be based on the setup.

15 seconds seems like a long time, I'm guessing most of that time is in booting up the jvm. If imo run this in the repl I feel like everything completes in under 3 seconds and likely half of that is printing in my editor.

I bet this project can use gravelvm to speed to up the startup from seconds to ms, though I'm no expert.

I haven't looked into the files generated.

1

u/m_woodworth Jul 08 '20

Your reply made me take a hard look at the mapping code - I was opening a filehandle in a tight loop.. oops.

Every time I calculated the hashed bucket based off a key, I would open the associated file, write, and close it. After moving the file opening outside of the loop, I went from about 10-15 seconds for each map to about 0.5.