Is the user's reputation calculated (1) by calculating all the upvotes and downvotes he received since he signed up, every time the page is refreshed or (2) is the user's reputation a number which is stored and when ever the user's gets a new upvote or downvote then the reputation number is updated?

  • 1
    The second, hence it can be out if something goes wrong. Every day at 3:00 am UTC there is a recalc, this includes checking for voting fraud etc. – Tim Sep 1 '15 at 9:43
  • If method (1) was used would it slow the site down? – MrDi Sep 1 '15 at 9:52
  • I expect so. Probably significantly. – Tim Sep 1 '15 at 9:53
  • Just one more thing, would do you mean by "hence it can be out if something goes wrong"? – MrDi Sep 1 '15 at 9:54
  • This happens less now, but there used to be a recalc button. This was incase something wasn't registered as a rep change - you could have different values showing in different plces. – Tim Sep 1 '15 at 9:56

No, those calculations are not done real-time. The reputation logic is too complex to be re-evaluated on the fly. It would bring the database to its knees.

This is roughly how I believe it works:

When an action is saved to the database that involves a reputation change, the userid is kept for later processing and the reputation change is send over the websocket (assuming the user is logged in/active). At a regular interval a batch process runs that will go over the userid's that have reputation changes and apply those changes in the user reputation history. Either this same batch process or yet another one will consolidate reputation history events. This explains why you sometime see up/down votes for the same post appear on multiple lines in your reputation history. A day later all those events are combined per post.

If you want an actual overview of what your reputation history looks like goto /reputation on any site. It bypasses any caching and serves you what is in the database stored for your reputation.

  • 1
    I don't think they store the event "for later processing", but rather the reputation itself (i.e. the column in Users table) is updated in real time, in matter of milliseconds. Then there are jobs running in intervals to make sure nothing fell between the cracks, and a daily job with a full recalculation just in case. But the reputation itself is real time, pretty sure of that. (NOT calculated on page load, but rather when sometimes that changes reputation happens, e.g. upvote/downvote.) – Shadow Wizard is Ear For You Oct 25 '17 at 22:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .