Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If writes are very rare compared to reads (a key assumption in most key-value stores, and not just in those;-), then you might prefer to take a time hit when you need to update scores (a write) rather than to get the relative leaderboards (a read). Specifically, when a user's score change, queue up tasks for each of their friends to update their "relative leaderboards" and keep those leaderboards as list attributes (which do keep order!-) suitably sorted (yep, the latter's a denormalization -- it's often necessary to denormalize, i.e., duplicate information appropriately, to exploit key-value stores at their best!-).</p> <p>Of course you'll also update the relative leaderboards when a friendship (user to user connection) disappears or appears, but those should (I imagine) be even rarer than score updates;-).</p> <p>If writes are pretty frequent, since you don't need perfectly precise up-to-the-second info (i.e., it's not financials/accounting stuff;-), you still have many viable approaches to try.</p> <p>E.g., big score changes (rarer) might trigger the relative-leaderboards recomputes, while smaller ones (more frequent) get stashed away and only applied once in a while "when you get around to it". It's hard to be more specific without ballpark numbers about frequency of updates of various magnitude, typical network-friendship cluster sizes, etc, etc. I know, like everybody else, you want a perfect approach that applies no matter how different the sizes and frequencies in question... but, you just won't find one!-)</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.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COThanks, this is helpful. Writes are very frequent as users accumulate points just for using the application on a day to day. I hadnt thought of the approach of having some kind of 'delta check' to decide when to update the relative boards (e.g., queue up an update when someone jumps by score of 10 or more) that will ensure that recomputes only happen for very active users. I can then increase this constant if it gets hit more and more frequently in order to minimize the re-computation exercise. Let me know if you have any other ideas
      singulars
    2. COSome rough metrics. Each user will generate an average of 10 points which will be distributed across 10 friends - 1 point given to each friend. So if a typical user has 10 friends, that user will accumulate 100 points per day - I could potentially use 50 points as the threshold for updating across the network
      singulars
    3. COOne idea might be: for a newbie user (say < 200 / 300 points or so) every update might be important, so you could set the recomputation threshold lower for those; and progressively higher for users that already have many points (gaining 90 when you already have 2350 is a minor thing, while gaining 90 when you start with 70 is huge;-). Whether that helps depends on "short head vs long tail" issues, i.e., does a lot of the scoring happen for very active users and not so much for the "long tail" of less-active ones?
      singulars
 

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