Justin,

> > > > > I see you have amavisd-new configured for 20 servers.
> > > > > Are you running out of memory?  CPU stuck at 100%?
>
> I think the problem is that I cannot find out where is the bottle neck.
> So my servers are:
>
> Postfix : 2 x Xeon 3.0 Ghz (4 core CPU)
>             8 GB RAM
>             Fast 15K rpm disks RAIDed (no io bottleneck)
>
> Amavis: 1 x Xeon 3.0 Ghz (2 core CPU)
>             4 GB RAM
>             Same fast 15K rpm SCSI disks RAIDed (no io bottleneck)
>
> It does not use 100% CPU all the time.
> Disk io is okay, has enough memory, CPU fine.
> Amavis timing looks normal.

A dual core Xeon with 4 GB RAM should be able to take more than
20 processes, perhaps 30.

> But still when postfix+amavis is all in one machine it is okay.
> When I separate them, then I see my postfix server active+incoming queue is
> growing.

> 10.150.10.6:10025        inet    n       -       n - - smtpd
>        -o smtpd_authorized_xforward_hosts=10.0.0.0/8
>        -o content_filter=
>        -o local_recipient_maps=
>        -o relay_recipient_maps=
>        -o smtpd_restriction_classes=
>        -o smtpd_client_restrictions=
>        -o smtpd_helo_restrictions=
>        -o smtpd_sender_restrictions=
>        -o smtpd_recipient_restrictions=permit_mynetworks,reject
>        -o mynetworks=10.0.0.0/8
>        -o strict_rfc821_envelopes=yes
>        -o 
> receive_override_options=no_unknown_recipient_checks,no_header_body_checks
> #
> 127.0.0.1:10025        inet    n       -       n - - smtpd
>        -o smtpd_authorized_xforward_hosts=127.0.0.0/8 
>        -o content_filter=
>        -o local_recipient_maps=
>        -o relay_recipient_maps=
>        -o smtpd_restriction_classes=
>        -o smtpd_client_restrictions=
>        -o smtpd_helo_restrictions=
>        -o smtpd_sender_restrictions=
>        -o smtpd_recipient_restrictions=permit_mynetworks,reject
>        -o mynetworks=127.0.0.0/8
>        -o strict_rfc821_envelopes=yes
>        -o 
> receive_override_options=no_unknown_recipient_checks,no_header_body_checks

Hmm. Does that actually work as expected? Binding one set of
smtpd processes on a loopback interface, and the other set
on an ethernet interface on the same port number?
I'd join both in a single entry, not specifying an interface
IP address, e.g.:

10025        inet    n       -       n - - smtpd
 -o smtpd_authorized_xforward_hosts=127.0.0.0/8,10.0.0.0/8
 -o content_filter=
 -o local_recipient_maps=
 -o relay_recipient_maps=
 -o smtpd_restriction_classes=
 -o smtpd_client_restrictions=
 -o smtpd_helo_restrictions=
 -o smtpd_sender_restrictions=
 -o smtpd_recipient_restrictions=permit_mynetworks,reject
 -o mynetworks=127.0.0.0/8,10.0.0.0/8
 -o strict_rfc821_envelopes=yes
 -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks

and just in case, add also the following options
to override any global rate limiting options you might have:

 -o smtpd_client_connection_limit_exceptions=0.0.0.0/0
 -o smtpd_client_connection_count_limit=0
 -o smtpd_client_connection_rate_limit=0
 -o smtpd_client_recipient_rate_limit=0

> I just want to send out everything that is scanned from amavis server
> because all the spams and bad messages are discarded.
>
> On amavisd.conf, if I put max_servers = 20 and max_requests = 20 then what
> are the effects of that change?

Don't bother with $max_requests, it is noncritical. Set it to 20 or 30.

The $max_servers _is_ an important tuning parameter.
Like I said above, I'd expect your host to be able to cope
with somewhat over 20 processes, perhaps 30.
The maxproc on the feeding smtp service 'amavis' should
specify the same number, definitely not more.


> Or on postfix master.cf, if I put  "smtp      inet  n       -
> n       -       500       smtpd" and more default_process for postfix to
> accept, then would it be better?

It probably would not have any effect, this is not your bottleneck.
Something like 200 or 300 smtpd processes should suffice for the
regular port 25.

> I am thinking the opposite maybe I would want to reduce the number of smtpd
> connections and have more amavis process running.

The number of smtpd processes is not directly related to the
number of content filtering processes. As a rule of thumb a factor
of 10 between the two is a good first approximation.

The number of smtpd processes on port 25 depends on the amount
of concurrent incoming smtp sessions trickling in, that you want
to accomodate. The number depends on one side on the amount of
mail flowing in, the speed of links (on your end and on client's),
the number of zombies trying to invade your mailer, ...
On the other side it depends on your host resources (memory,
file descriptors limits, number of *_maps used and their type
(cdb is more lightweigth that berkeley db, which in turn is
more lightweight than SQL).

The number of content filtering processes depend on host's
horespower - CPU, memory, and on the selection of rules and
other tests that SpamAssassin is doing, like Bayes and AWL
data type.

> Oh and please look at my last part of the amavisd.conf file and sql lookup
> setting. I wanted amavis server to connect upto MySQL running on postfix
> server. And check if the user is valid one or not. It checks the domain if
> it exists in my virtual domain table. Am I doing it correctly?

$sql_select_policy =
 'SELECT "Y" as local FROM domain WHERE CONCAT("@",domain) IN (%k)';

Seems fine.

Btw, you could get rid of a CONCAT("@",...) by setting:

  $sql_lookups_no_at_means_domain = 1;


amavisd-new-2.4.3 release notes:

- added global configuration variables $sql_lookups_no_at_means_domain and
  $ldap_lookups_no_at_means_domain, both false by default. They control
  whether a database mail address field with no '@' character represents
  a local username, or a domain name. By default (value false) it indicates
  a username in SQL and LDAP lookups (but represents a domain in hash and
  acl lookups), so domain names in SQL and LDAP should be specified as
  '@domain'. Setting these to true will cause 'xxx' to be interpreted as
  a domain name, just like in hash or acl lookups, which may facilitate
  interoperability with databases from other applications;

To get rid of a warning about a missing field 'id', try the following:

$sql_lookups_no_at_means_domain = 1;
$sql_select_policy =
  'SELECT *, user.id'.
  ' FROM (SELECT 1 as id, 99 as policy_id, "Y" AS local'.
        ' FROM domain WHERE domain_name IN (%k)) AS user'.
  ' LEFT JOIN policy ON policy_id=policy.id';

Anyway, this probably has not influence on your performance problem.


> content_filter = amavis:[10.150.10.150]:10024
> default_destination_concurrency_limit = 20
> default_process_limit = 150
> local_destination_concurrency_limit = 2
> smtpd_client_recipient_rate_limit = 50

> amavis unix    -       -       n       -       12      smtp
>       -o smtp_data_done_timeout=1200
>       -o smtp_send_xforward_command=yes
>       -o disable_dns_lookups=yes
>       -o fallback_relay=127.0.0.1:10024

The amavis_destination_concurrency_limit overrides the
default_destination_concurrency_limit; the minimum of maxproc
in master.cf and the amavis_destination_concurrency_limit
controls the number of parallel sessions to a content filter.

So if you want more than 20 feeds to content filtering processes
(the default_destination_concurrency_limit), you need to
specify it explicitly:

amavis_destination_concurrency_limit = 29

> virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
> virtual_gid_maps = static:89
> virtual_mailbox_base = /usr/local/virtual
> virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
> virtual_mailbox_limit = 100000000
> virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
> virtual_minimum_uid = 89
> virtual_transport = virtual
> virtual_uid_maps = static:89

Heavy lookups like SQL or LDAP should go through a Postfix proxy
service, e.g.:

virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

> Can this be a DNS related problem? Does amavis server need to have the
> correct DNS server setup? (the same one as the postfix server is using?)

Could be. When postfix receives a connection, it does a reverse DNS
lookup. If your DNS resolver does not map 10.150.10.150 to a name
fast enough, it stalls the smtpd service which is receiving feed
back from amavisd. Do a proper DNS registration of 10.150.10.150,
and use a fast enough caching name server.

> Sep 12 22:34:00 amavis1 amavis[15774]: (15774-01-6) TIMING [total 14662
> ms] - lookup_sql: 4 (0%)0, SMTP pre-DATA-flush: 2 (0%)0, SMTP DATA: 35
> (0%)0, check_init: 1 (0%)0, digest_hdr: 1 (0%)0, digest_body: 0 (0%)0,
> gen_mail_id: 1 (0%)0, check_header: 3 (0%)0, spam-wb-list: 4 (0%)0, SA
> parse: 4 (0%)0, SA check: 14556 (99%)100, update_cache: 11 (0%)100,
> decide_mail_destiny: 3 (0%)100, fwd-connect: 13 (0%)100, fwd-xforward: 1
> (0%)100, fwd-mail-pip: 4 (0%)100, fwd-rcpt-pip: 0 (0%)100, fwd-data-chkpnt:
> 0 (0%)100, write-header: 2 (0%)100, fwd-data-contents: 0 (0%)100,
> fwd-end-chkpnt: 4 (0%)100, prepare-dsn: 1 (0%)100, main_log_entry: 10
> (0%)100, update_snmp: 2 (0%)100, SMTP pre-response: 1 (0%)100, SMTP
> response: 0 (0%)100, unlink-0-files: 0 (0%)100, rundown: 0 (0%)100

This looks about right, although spam scanning time is on the high side.
3-4 seconds average would be more normal. Perhaps you need to check
if some RBL service is often congested and remove it. Consider
reducing rbl_timeout if you have it at a default, perhaps down
to 10 or 8 seconds. Is your Bayes database sane and fast enough?
(it seems to work best on MySQL using InnoDB engine and the dedicated
SpamAssassin plugin). Consider also applying my patch to SA 3.2.3:
  http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5589
  http://issues.apache.org/SpamAssassin/attachment.cgi?id=4081

> Sep 12 22:34:01 amavis1 amavis[15758]: Net::Server: 2007/09/12-22:34:01
> Server closing!
> Sep 12 22:34:01 amavis1 amavis[15765]: (15765-01-11) (!)TempDir removal:
> tempdir is to be PRESERVED: /var/amavis/tmp/amavis-20070912T223232-15765

Was that you, aborting the server, or did it happen by itself?
If the later, this is no good, you need to track down the reason
and fix it. Check at log level 5 what happens just before such event.

  Mark

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to