Rules.
You create events in the system, and use rules within an event stream processor.
Specifically, say you have a badge "made 10 posts". You don't run "select count(*) from posts where user = :user" for every post. Rather, you have a simple rule that watches each post come by, and "count them", storing the rules state in the user profile.
That way "made 10 posts" is as cheap as "made 1,000,000" posts.
This also makes the system much more extensible.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…