On Wed, Sep 04, 2013 at 09:34:49AM -0400, Nikolas Everett wrote:
I worked on an accounting system with similar
requirements and we had
an even more complicated system but one you might want to consider:
1. When something happens record the event and how much it changed
the value along with a timestamp. In our case we'd just have enable
and disable events.
2. We ran a job that summarized those events into hourly changes.
3. Every day we a log of the actual value (at midnight or whatever).
This let us quickly make all kinds of crazy graphs with super deep
granularity over short periods of time and less granularity over long
periods of time. Essentially it was an accountant's version of
RRDtool. It didn't have problems with getting out of sync because we
never had more than one process update more than one field.
It is probably overkill but might serve as a dramatic foil to the simpler ideas.
Thanks a lot, Nik - I'm sure it is overkill, but it sounds like one of the
more seamless solutions without being too heavy on performance. Probably
our solution will look like "fire events to update the counts, then sync
them periodically when some number of events have fired *or* when some
amount of time has passed without a sync."
I'll set about working on that now; should be a fun day, since I've never
worked with our job queue before :)
In other news, the BetaFeatures framework, as well as the start of our
MultimediaViewer, is up at
http://multimedia-alpha.wmflabs.org - go ahead
and experiment!
--
Mark Holmquist
Software Engineer, Multimedia
Wikimedia Foundation
mtraceur(a)member.fsf.org
https://wikimediafoundation.org/wiki/User:MHolmquist