https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6942

--- Comment #38 from Mark Martinec <[email protected]> ---
> What are the gottchas?

Downsides of using a hash with spam and ham counters as token values
(compared to token values stored as packed short binary strings):

- about 6 % increase in memory usage;

- a lookup on tokens (tok_get_all) is about 2.3 x slower (15-20 ms vs. 8-9 ms)
  when Lua is *not* available (i.e. redis server 2.4 or earlier) and network
  packet rate is higher with unpatched CPAN Redis interface module - but both
  stay at about the same level when using a redis server 2.6 (which has Lua).

- incompatible database with current code

Upsides:

- counter increments (when learning) are atomic - avoids race conditions
  which can cause missed counts when multiple processes learn the same tokens
  at about the same time

- much faster 'touching' of observed tokens (re-setting their expiration time),
  roughly 1 ms vs. 5 ms when Lua is available, with a corresponding
  substantial packet rate reduction (2 packets per mail check vs. 2 packets
  per token)

- faster learning (with Lua): 2 packets per learn vs. approx 2 packets
  per token)


> - How do we know if the running server uses/supports the required LUA

Lua should be in 2.6 redis servers.

To check:
  $ redis-cli info | fgrep lua
  used_memory_lua:...

also:
  $ redis-cli info | fgrep redis_version


> is this a SA machine thing or on Redis server only?

The server's version matters.

Not sure about the version of the CPAN Redis module.
The 1.952 (2012-09-04) claims "Support Redis 2.6",
the 1.900_01 (2011-01-30) claims: "full support for Redis 2.x
multi-bulk protocol".

> - Do we need to wipe Redis DB to use this update?

Not required, but the new code will ignore old tokens (which will
eventually expire) and will store new ones in a separate namespace
"t:..." vs "w:...", so you may just as well start from scratch.
It would be possible to add some transition code if necessary.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to