You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Marcin Mirosław <ma...@mejor.pl> on 2012/10/23 11:49:13 UTC

SA-3.3.2 options max-spare and max-children doesn't work as i expect

Hello list!
I'm playing with options min-spare,max-spare,min-children and
max-children, I'd like to save memory on my vps. So I'd like to have one
children awaiting for connection from MTA, when MTA receives more emials
in short time I'd like SA to spawn more children (max-children=6). I
thinks it's enough to have zero (or one) spare children in my case.
I'm starting spamd with such parameters:
... --min-spare=0 --max-spare=1 -m 6
I'm expecting I can check 6 emails in the same time because option "-m
6" suggests that six children should be spawned.
Ok, so I've got 2 proceessess:
# pgrep -fc spamd
2
It's ok as for now. Now I'm starting scanning 6 mails at one time:

# (for x in $(seq 1 6); do spamc -c </tmp/q1TQY7Z-4358 >/dev/null &
done) ; pgrep -fc spamd ; sleep 1; pgrep -fc spamd;sleep 1;pgrep -fc spamd
2
2
2
Hmm, still I've got 2 processes (parent+one child).

Let me change start option for spamd:
... --min-spare=0 --max-spare=3 -m 6
# pgrep -fc spamd
4
(How much time of innactivity is needed to kill spare, unused child?).
And I'm launching one-liner:
# (for x in $(seq 1 6); do spamc -c </tmp/q1TQY7Z-4358 >/dev/null &
done) ; pgrep -fc spamd ; sleep 1; pgrep -fc spamd;sleep 1;pgrep -fc
spamd
4
4
4
So for me it looks like max-spare limits max number of children, me
seems it's not desired behavior.
In log I can find:
 spamd[21140]: prefork: child states: BBB
So spamd really didn't spawn more childs.

Am I doing something wrong?

I've found answer for one question:
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6754


Re: SA-3.3.2 options max-spare and max-children doesn't work as i expect

Posted by Marcin Mirosław <ma...@mejor.pl>.
W dniu 23.10.2012 15:52, Bowie Bailey pisze:
> On 10/23/2012 7:30 AM, Marcin Mirosław wrote:
>> W dniu 23.10.2012 12:03, Arthur Dent pisze:
>> [...]
>>> Just thought I'd ask...
>>>
>>> You did restart SA after you made the changes?
>> Yes I did. In meanwhile I've found bug
>> https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6843 . But it
>> doesn't give me anwser why max-spare limit max childs. (And honestly
>> it's strange for me how min,max/children,spare options works).
>> Regards,
>> Marcin
> 
> spare = idle child process
> 
> So...
> 
> min-spare = minimum number of idle child processes
> max-spare = maximum number of idle child processes
> 
> min-children = minimum number of children (busy or idle)
> max-children = maximum number of children (busy or idle)
> 
> Usually, max-children is the one you want to adjust.  Make it high
> enough to handle your load, but make sure you don't over-commit your
> RAM.  If you start swapping, everything slows to a crawl.
> 

This is what I thought but as you can see in my test case spamd doesn't
behave in this way. (e.g. I can't start more childs than set with option
max-spare)

Re: SA-3.3.2 options max-spare and max-children doesn't work as i expect

Posted by Bowie Bailey <Bo...@BUC.com>.
On 10/23/2012 7:30 AM, Marcin Mirosław wrote:
> W dniu 23.10.2012 12:03, Arthur Dent pisze:
> [...]
>> Just thought I'd ask...
>>
>> You did restart SA after you made the changes?
> Yes I did. In meanwhile I've found bug
> https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6843 . But it
> doesn't give me anwser why max-spare limit max childs. (And honestly
> it's strange for me how min,max/children,spare options works).
> Regards,
> Marcin

spare = idle child process

So...

min-spare = minimum number of idle child processes
max-spare = maximum number of idle child processes

min-children = minimum number of children (busy or idle)
max-children = maximum number of children (busy or idle)

Usually, max-children is the one you want to adjust.  Make it high 
enough to handle your load, but make sure you don't over-commit your 
RAM.  If you start swapping, everything slows to a crawl.

-- 
Bowie

Re: SA-3.3.2 options max-spare and max-children doesn't work as i expect

Posted by Marcin Mirosław <ma...@mejor.pl>.
W dniu 23.10.2012 12:03, Arthur Dent pisze:
[...]
> Just thought I'd ask...
> 
> You did restart SA after you made the changes?

Yes I did. In meanwhile I've found bug
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6843 . But it
doesn't give me anwser why max-spare limit max childs. (And honestly
it's strange for me how min,max/children,spare options works).
Regards,
Marcin

Re: SA-3.3.2 options max-spare and max-children doesn't work as i expect

Posted by Arthur Dent <mi...@blueyonder.co.uk>.
> Hello list!
> I'm playing with options min-spare,max-spare,min-children and
> max-children, I'd like to save memory on my vps. So I'd like to have one
> children awaiting for connection from MTA, when MTA receives more emials
> in short time I'd like SA to spawn more children (max-children=6). I
> thinks it's enough to have zero (or one) spare children in my case.
> I'm starting spamd with such parameters:
> ... --min-spare=0 --max-spare=1 -m 6
> I'm expecting I can check 6 emails in the same time because option "-m
> 6" suggests that six children should be spawned.
> Ok, so I've got 2 proceessess:
> # pgrep -fc spamd
> 2
> It's ok as for now. Now I'm starting scanning 6 mails at one time:
>
> # (for x in $(seq 1 6); do spamc -c </tmp/q1TQY7Z-4358 >/dev/null &
> done) ; pgrep -fc spamd ; sleep 1; pgrep -fc spamd;sleep 1;pgrep -fc spamd
> 2
> 2
> 2
> Hmm, still I've got 2 processes (parent+one child).
>
> Let me change start option for spamd:
> ... --min-spare=0 --max-spare=3 -m 6
> # pgrep -fc spamd
> 4
> (How much time of innactivity is needed to kill spare, unused child?).
> And I'm launching one-liner:
> # (for x in $(seq 1 6); do spamc -c </tmp/q1TQY7Z-4358 >/dev/null &
> done) ; pgrep -fc spamd ; sleep 1; pgrep -fc spamd;sleep 1;pgrep -fc
> spamd
> 4
> 4
> 4
> So for me it looks like max-spare limits max number of children, me
> seems it's not desired behavior.
> In log I can find:
>  spamd[21140]: prefork: child states: BBB
> So spamd really didn't spawn more childs.
>
> Am I doing something wrong?

Just thought I'd ask...

You did restart SA after you made the changes?


Re: [solved] SA-3.3.2 options max-spare and max-children doesn't work as i expect

Posted by Marcin Mirosław <ma...@mejor.pl>.
W dniu 23.10.2012 22:24, RW pisze:

Hi,

> On reading you your question more thoroughly I see that your main
> point was that you aren't getting as many processes as expected.
> 
> The number of child processes isn't adjusted immediately, it's
> incremented or decremented when a child announces that it is idle.
> Testing with only six calls isn't enough to expect sensible results.
> 
> What you need to do is hammer spamd with lots more spamc calls  and
> watch the number of child processes evolve in real time - maybe have
> the background processes log the child count as each spamc process
> completes. 

Indeed, I've flooded spamd with many connections. In results I got as
much spamd processess as I defined using "-m" option.
Thanks for tip, now all is clear for me.

Regards,
Marcin

Re: SA-3.3.2 options max-spare and max-children doesn't work as i expect

Posted by RW <rw...@googlemail.com>.
On Tue, 23 Oct 2012 19:03:48 +0100
RW wrote:


> > Hello list!
> > I'm playing with options min-spare,max-spare,min-children and
> > max-children, I'd like to save memory on my vps. So I'd like to have
> > one children awaiting for connection from MTA, when MTA receives
> > more emials in short time I'd like SA to spawn more children
> > (max-children=6). I thinks it's enough to have zero (or one) spare
> > children in my case. I'm starting spamd with such parameters:
> > ... --min-spare=0 --max-spare=1 -m 6
> 
> You can't use min-spare less than 1, if you do it gets adjusted to 1. 
> 
> spamd only adjusts the number of children when it's out of bounds. If
> you had min-spare=0 then a state with no spare children would be in
> bounds and there would be no mechanism to increase the number of
> children.

On reading you your question more thoroughly I see that your main
point was that you aren't getting as many processes as expected.

The number of child processes isn't adjusted immediately, it's
incremented or decremented when a child announces that it is idle.
Testing with only six calls isn't enough to expect sensible results.

What you need to do is hammer spamd with lots more spamc calls  and
watch the number of child processes evolve in real time - maybe have
the background processes log the child count as each spamc process
completes. 




   

Re: SA-3.3.2 options max-spare and max-children doesn't work as i expect

Posted by RW <rw...@googlemail.com>.
On Tue, 23 Oct 2012 11:49:13 +0200
Marcin Mirosław wrote:

> Hello list!
> I'm playing with options min-spare,max-spare,min-children and
> max-children, I'd like to save memory on my vps. So I'd like to have
> one children awaiting for connection from MTA, when MTA receives more
> emials in short time I'd like SA to spawn more children
> (max-children=6). I thinks it's enough to have zero (or one) spare
> children in my case. I'm starting spamd with such parameters:
> ... --min-spare=0 --max-spare=1 -m 6

You can't use min-spare less than 1, if you do it gets adjusted to 1. 

spamd only adjusts the number of children when it's out of bounds. If
you had min-spare=0 then a state with no spare children would be in
bounds and there would be no mechanism to increase the number of
children.