Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The best strategy depends on the nature of your map-reduce job.</p> <p>If you're using a <strong>separate map-reduce call for each individual user</strong>, I would go with the first or second strategy. The advantage of the second strategy over the first strategy is that you always have a result ready. So when the user makes a request and the result is outdated, you can still present the old result to the user, while running a new map-reduce in the background to generate a fresh result for the next requests. This has the following advantages:</p> <ul> <li>The user doesn't have to wait for the map-reduce to complete, which is important if the map-reduce may take a while to complete. The exception is of course the very first map-reduce call; at this point there is no old result available.</li> <li>You're automatically running map-reduce only for the active users, reducing the load on the database.</li> </ul> <p>If you're using a <strong>single, application-wide map-reduce call for all users</strong>, the third strategy is the best approach. You can easily achieve this by specifying an <a href="http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-NoteonPermanentCollections" rel="nofollow">output collection</a>. The advantages of this approach:</p> <ul> <li>You can easily control the freshness of the result. If you need more up-to-date results, or need to reduce the load on the database, you only have to adjust the schedule.</li> <li>Your application code isn't responsible for managing the map-reduce calls, which simplifies your application.</li> </ul> <p>If a user can only see his or her own ratings, I'd go with strategy one or two, or include a <code>lastActivity</code> timestamp in user profiles and run an application-wide scheduled map-reduce job on the active subset of the users (strategy 3). If a user can see any other user's ratings, I'd go with strategy 3 as well, as this greatly reduces the complexity of the application.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload