title: Should I learn/use MapReduce, or some other type of parallelization for this task?
body: <p>After talking with a friend of mine from Google, I'd like to implement some kind of Job/Worker model for updating my dataset. </p>
  
  <p>This dataset mirrors a 3rd party service's data, so, to do the update, I need to make several remote calls to their API. I think a lot of time will be spent waiting for responses from this 3rd party service. I'd like to speed things up, and make better use of my compute hours, by parallelizing these requests and keeping many of them open at once, as they wait for their individual responses. </p>
  
  <p>Before I explain my specific dataset and get into the problem, I'd like to clarify what answers I'm looking for:</p>
  
  <ol>
  <li>Is this a flow that would be well suited to parallelizing with MapReduce?</li>
  <li>If <strong>yes</strong>, would this be cost effective to run on Amazon's mapreduce module, which bills by the hour, and rounds hour's up when the job is complete? (I'm not sure exactly what counts as a "Job", so I don't know exactly how I'll be billed)</li>
  <li>If <strong>no</strong>, Is there another system/pattern I should use? <strong>and</strong> Is there a library that will help me do this in python (On AWS, usign EC2 + EBS)?</li>
  <li>Are there any problems you see with the way I've designed this job flow? </li>
  </ol>
  
  <p>Ok, now onto the details:</p>
  
  <p>The dataset consists of users who have favorite items and who follow other users. The aim is to be able to update each user's queue -- the list of items the user will see when they load the page, based on the favorite items of the users she follows. But, before I can crunch the data and update a user's queue, I need to make sure I have the most up-to-date data, which is where the API calls come in. </p>
  
  <p>There are two calls I can make: </p>
  
  <ul>
  <li><em>Get Followed Users</em> -- Which returns all the users being followed by the requested user, and </li>
  <li><em>Get Favorite Items</em> -- Which returns all the favorite items of the requested user.</li>
  </ul>
  
  <p>After I call <em>get followed users</em> for the user being updated, I need to update the favorite items for each user being followed. Only when all of the favorites are returned for all the users being followed can I start processing the queue for that original user. This flow looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/9DDQP.png" alt="Updating UserX&#39;s Queue"></p>
  
  <p>Jobs in this flow include:</p>
  
  <ul>
  <li><em>Start Updating Queue</em> for user -- kicks off the process by fetching the users followed by the user being updated, storing them, and then creating <em>Get Favorites</em> jobs for each user.</li>
  <li><em>Get Favorites</em> for user -- Requests, and stores, a list of favorites for the specified user, from the 3rd party service.</li>
  <li><em>Calculate New Queue</em> for user -- Processes a new queue, now that all the data has been fetched, and then stores the results in a cache which is used by the application layer. </li>
  </ul>
  
  <p>So, again, my questions are: </p>
  
  <ol>
  <li>Is this a flow that would be well suited to parallelizing with MapReduce? I don't know if it would let me start the process for UserX, fetch all the related data, and come back to processing UserX's queue only after that's all done. </li>
  <li>If <strong>yes</strong>, would this be cost effective to run on Amazon's mapreduce module, which bills by the hour, and rounds hour's up when the job is complete? Is there a limit on how many "threads" I can have waiting on open API requests if I use their module? </li>
  <li>If <strong>no</strong>, Is there another system/pattern I should use? <strong>and</strong> Is there a library that will help me do this in python (On AWS, usign EC2 + EBS?)?</li>
  <li>Are there any problems you see with the way I've designed this job flow? </li>
  </ol>
  
  <p>Thanks for reading, I'm looking forward to some discussion with you all. </p>
  
  <p><strong>Edit</strong>, in response to JimR:</p>
  
  <p>Thanks for a solid reply. In my reading since I wrote the original question, I've leaned away from using MapReduce. I haven't decided for sure yet how I want to build this, but I'm beginning to feel MapReduce is better for distributing / parallelizing computing load when I'm really just looking to parallelize HTTP requests. </p>
  
  <p>What would have been my "reduce" task, the part that takes all the fetched data and crunches it into results, isn't that computationally intensive. I'm pretty sure it's going to wind up being one big SQL query that executes for a second or two per user. </p>
  
  <p>So, what I'm leaning towards is:</p>
  
  <ul>
  <li>A non-MapReduce <strong>Job/Worker</strong> model, written in <strong>Python</strong>. A google friend of mine turned me onto learning Python for this, since it's low overhead and scales well. </li>
  <li>Using Amazon EC2 as a compute layer. I think this means I also need an EBS slice to store my database. </li>
  <li>Possibly using Amazon's Simple Message queue thingy. It sounds like this 3rd amazon widget is designed to keep track of job queues, move results from one task into the inputs of another and gracefully handle failed tasks. It's very cheap. May be worth implementing instead of a custom job-queue system. </li>
  </ul>