V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
lianghui
V2EX  ›  分享创造

分享开源一个 Python 写的百万数据的排行系统

  •  
  •   lianghui ·
    whiteclover · 2014-08-18 09:49:35 +08:00 · 2804 次点击
    这是一个创建于 3754 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Leaf

    Leaf is a Leaderboard system that helps you rank million user data.

    项目已经完成基本功能,但还是有比较多bug。 项目是为了建立一个可复用抽象的排行系统模块。

    现在支持分布式定时任务,mysql直排和三种有效的桶排。将来将会集成多数据库支持。

    项目地址: https://github.com/thomashuang/Leaf

    Design

    In system, supporting two leaderboard ways, one is ranking by score DESC,the same score has the same rank; another is 'dense' that ranks by score DESC, entry id ASC, the same score has diffrent rank order by entry id ASC.

    In leaderboard attribute 'adapter', has four values ('base', 'bucket', 'block', 'chunk'), they are four leaderboard algorithms, but the kernel algorithm is bucket sort algorithm.

    .. note:: When you don't use base adapter to rank leaderboard, you shuld set cron to fresh the bucket table

    Base MySQL SQL

    When set leaderboard adapter to 'base', the system will use the MySQL SQL, realtime sort the entries.
    It suits for small data leaderboard that less 10k data.

    Score Bucket

    When set leaderboard adapter to 'bucket', it will summary user count by score to help rank your leaderboard.

    Block Bucket

    When set leaderboard adapter to 'block', it will summary user's conunt by a static scoce grap, like score block [0-100], [101-200]…,
    it can be used to rank the user score histgram is steady and smooth.

    Chunk Bucket

    When set leaderboard adapter to 'chunk', unlike block algorithm using a static score grap, but is dynamic score grap that makes sure user's count between a suitable range like (5000, 10000]

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   6051 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 02:25 · PVG 10:25 · LAX 18:25 · JFK 21:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.