Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] slow reloading of the database: the problem explained

2007-01-10 by Emmanuel Dreyfus

On Wed, Jan 10, 2007 at 04:40:33PM +0900, AIDA Shinra wrote:
> > Attached is a patch that remove the sorting of tuples. It restores the
> > instant loading time we had before 3.1 series. Feedback is welcome: does
> > it harm in any way to nuke that code?
> 
> The whole database need to be sorted in order for pending_timeout()
> and autowhite_timeout() to work.
> 
> I think pending_insert_to_queue() and autowhite_insert_to_queue()
> finish quickly as long as entries are inserted in old-to-new order. Am
> I wrong? Profiler will clarify where is the problem.

That functions causes the reloading operation to switch from O(n) to O(n^2),
since we have to walk all previously inserted tuples before inserting a new
tuple. The cost is huge for a big databases.

When I wrote milter-greylist at once, I did no special effort at cleaning 
all timed out entries. I just kicked them out occasionnally when I encountered
them while walking the database for seach and dump operations. 

Of course, as a search succeeds before walking the whole database, some 
timed out entries remained undeleted. That does not really matter, it justs
uses memory. Andanyway, we still often walk (and therefore clean up) the 
whole database each time a new message gets in.

I think it would be wise to get back to that situation. I'll do that if
nobody objects.

-- 
Emmanuel Dreyfus
manu@...

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.