Services/Sync/Server/Notes/QuotaAlgo

< Services‎ | Sync‎ | Server
Revision as of 22:10, 8 July 2010 by Telliott (talk | contribs)

Define low_threshold = quota - 1M

On a write

- If a user has no quota entry, grab the list from the database and put it into memcache along with the current timestamp
- get current total and associated timestamp
- if total > low_threshold and timestamp is older than 1h - refetch total from db and reset total and timestamp in memcache
- if total > quota, reject write
- write data
- add sum of incoming payloads to quota
- if total > low_threshold, add an X-Weave header

On a delete

- delete data
- delete user quota record from memcache

add /info/collection_usage (requires version bump to 1.1)

- get grouped collection totals
- write overall total to memcache

monitoring script

- when user total is calculated, update memcache (may be firewall issues here)