On Wed, 5 Aug 2015 07:47:20 -0700 Ian Zimmerman wrote: > On 2015-08-05 12:58 +0100, RW wrote: > > > The number of tokens is within 0.5% of the configured value. It's > > designed to produce a value between 75% and roughly 150%. > > I can't quite parse that answer, so let's be more specific. > > Doc says: > > bayes_expiry_max_db_size (default: 150000) > > What should be the maximum size of the Bayes tokens database? > When expiry occurs, the Bayes system will keep either 75% of the > maximum value, or 100,000 tokens, whichever has a larger value. > > From this (and the more elaborate description in the EXPIRATION > section, which I've also read) I thought it worked roughly like this: > > if (ntokens < bayes_expiry_max_db_size) > do_nothing() >
That bit is only for auto-expiry > goal_ntokens = max(100000, 0.75 * bayes_expiry_max_db_size) > while (ntokens > goal_ntokens) > kill_oldest_tokens() What it actually does is estimate a cut-off time and then delete all tokens older than that. How it gets the cut-off time is described the next two sections: EXPIRE LOGIC and ESTIMATION PASS LOGIC.