1 (edited by slimwoogi 2012-06-14 09:20:20)

Topic: Send mail by using java mail API very slow.

Hi~ Zhang.

- IRedMail 0.8.0 (LDAP backend)
- Ubuntu 12.04

I've migrated mail server from (Sendmail + Dovecot + Spamassassin) to IRedMail recently.

After fixing some problem (with your kind help big_smile), All is fine.

But I have one problem.

Some Web Application System send mail using Java Mail API. Before migration there was no problems.
But After migration some web page(sending email to someone) is very slow. more recipients, more slow.(1 recipient takes abount 1 sec. 10 recipients take abount 10 sec.)

All mails from Web Application System is sent to local-domain user. (sys-admin@example.com --> user1@example.com,user2@example.com ...)

Is there any way to enhance  performance?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by slimwoogi 2012-06-14 11:19:07)

Re: Send mail by using java mail API very slow.

I read article 'IRedMail/FAQ/Disable.Spam.Virus.Scanning.for.Outgoing.Mails'

bypassing amavisd's spam/virus/header checking for outgoing mail can be helpful?

3

Re: Send mail by using java mail API very slow.

slimwoogi wrote:

I read article 'IRedMail/FAQ/Disable.Spam.Virus.Scanning.for.Outgoing.Mails'

bypassing amavisd's spam/virus/header checking for outgoing mail can be helpful?


I've tried. still slow. (took about 7 sec for 4 recipients).

4

Re: Send mail by using java mail API very slow.

I've debuged Java mail api and found that 'RCPT TO:' command took about 2 sec. per each recipient.

I want to skip some security process.

any idea?

5

Re: Send mail by using java mail API very slow.

I've changed /ect/postfix/main.cf like belows.

---------------------------------------------------------------------------
...
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unlisted_recipient, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname
...
----------------------------------------------------------------------------

I've removed 2 restrictions for recipients " check_policy_service inet:127.0.0.1:7777, check_policy_service inet:127.0.0.1:10031". maybe IRedAPD and policyd.

Now sending mail is less than 1sec.

But I think this is not good for security. Is there any workarounds. I want to skip these 2 restriction only for local domain user.

6

Re: Send mail by using java mail API very slow.

Did you try to add the IP address of you Java mail API client in Postfix 'mynetworks = '? Also, remove "reject_unknown_sender_domain, reject_unknown_recipient_domain," in Postfix 'smtpd_recipient_restrictions' will speed it up by avoid DNS queries.

May i know this iRedMail server is a normal mail server or used for sending newsletter?

7 (edited by slimwoogi 2012-06-14 18:56:49)

Re: Send mail by using java mail API very slow.

ZhangHuangbin wrote:

Did you try to add the IP address of you Java mail API client in Postfix 'mynetworks = '? Also, remove "reject_unknown_sender_domain, reject_unknown_recipient_domain," in Postfix 'smtpd_recipient_restrictions' will speed it up by avoid DNS queries.

May i know this iRedMail server is a normal mail server or used for sending newsletter?

Yes. Zhang IRedMail Server is normal mail server which has 1 domain(1 alias domain) and about 500 users.
Web application just uses iRedMail server for sending notification emails for some action on it. No bulk mail or newsletter.

And java mail api client(Web Application server) is works on same network with IRedMail Server.

Always thanks for your help big_smile

8

Re: Send mail by using java mail API very slow.

It's not recommended to change default Postfix settings for a normal mail server, especially Policyd (check_policy_service inet:127.0.0.1:10031).

Try this to bypass spam/virus scanning instead of disable them in Amavisd:

Edit /etc/postfix/master.cf, update default 'pickup' transport, append one line (starts with at least one space character):

pickup    ...
  -o content_filter=

Restarting Postfix is required.
After this update, all emails generated locally will be bypass Amavisd+SpamAssassin+ClamAV.

9 (edited by slimwoogi 2012-06-19 17:10:54)

Re: Send mail by using java mail API very slow.

ZhangHuangbin wrote:

It's not recommended to change default Postfix settings for a normal mail server, especially Policyd (check_policy_service inet:127.0.0.1:10031).

Try this to bypass spam/virus scanning instead of disable them in Amavisd:

Edit /etc/postfix/master.cf, update default 'pickup' transport, append one line (starts with at least one space character):

pickup    ...
  -o content_filter=

Restarting Postfix is required.
After this update, all emails generated locally will be bypass Amavisd+SpamAssassin+ClamAV.





I agree with you. I don't want to change Postfix's default setting for Policyd.

So I've tried as you post.

1st. Restore default '/etc/postfix/main.cf'
2nd. And add 1 line(starts with 7 space character '-o content_filter=') to '/etc/postfix/master.cf'
3rd. restart postfix.

But sending mail too slow.(abount 10 sec. for  recipients)
What's the problem?

10

Re: Send mail by using java mail API very slow.

- Did you add the IP address of you Java mail API client in Postfix 'mynetworks = '?
- Did you try to figure out which step in Postfix slow it down?

11

Re: Send mail by using java mail API very slow.

ZhangHuangbin wrote:

- Did you add the IP address of you Java mail API client in Postfix 'mynetworks = '?
- Did you try to figure out which step in Postfix slow it down?

Yes. I've added IP address.
And when I debugged java mail api, I found  'RCPT TO:' command took many seconds.
I think validation of recipients step is very complex and slow.

12

Re: Send mail by using java mail API very slow.

slimwoogi wrote:

And when I debugged java mail api, I found  'RCPT TO:' command took many seconds.

Is it possible for your to remove one restriction rule each time in Postfix option 'smtpd_recipient_restrictions' for debugging? Then figure out which one takes long time.