Is Ranklist still needed?

132 views
Skip to first unread message

Steven

unread,
Jul 18, 2011, 9:54:33 AM7/18/11
to Google App Engine Ranklist
Now GAE no longer the size of query returns to 1000 is it still
necessary to use a scheme like Ranklist to manage a high score table?

Could one now use a system such as:

public int getRank(HighScore score) {
int totalNum = ofy().query(HighScore.class)
.filter("mGame", score.getGame())
.filter("mScore >=", score.getScore())
.order("MAIN_SOCRE")
.order("SECONDARY_SCORE").count();

int numAfter = ofy().query(HighScore.class)
.filter("mGame", score.getGame())
.filter("MAIN_SCORE", score.getScore())
.filter("SECONDARY_SCORE >", score.getTimeStamp())
.order("SECONDAY_SCORE").count();

return totalNum - numAfter;
}

This does not seem to suffer from the problem of needing to pre-define
a range. Would this scale well for a large number of scores?

Thank you for your help.

Bartholomew Furrow

unread,
Jul 18, 2011, 5:08:59 PM7/18/11
to google-app-en...@googlegroups.com
Hi Steven,

App Engine's technology has seen huge improvements since we first wrote this library.  For small scoreboards, what you've described should work great.  After playing around for a bit on Code Jam, I have the following numbers from using just one primary score:

- If we're dealing with a total of ~100,000 rows, and you query rank 20,000, it takes about 0.9 seconds.
- If you query rank 84,000, it takes about 4.5 seconds (+/- 1.5 seconds).

This is vaguely linear, so I'd say you can get the count of about 20k rows per second.  For a prototype, an early-stage product or a product that you don't expect to scale beyond 2,000 people per ranklist, your solution is probably better: it takes less time to implement, and it's less complex.  If you want something that runs fast at scale, the ranklist looks like the better option.

Note: The numbers I pulled are for one app, running on non-high-replication.  YMMV.

Cheers,
Bartholomew


--
You received this message because you are subscribed to the Google Groups "Google App Engine Ranklist" group.
To post to this group, send email to google-app-en...@googlegroups.com.
To unsubscribe from this group, send email to google-app-engine-r...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-app-engine-ranklist?hl=en.


Reply all
Reply to author
Forward
0 new messages