[
https://issues.apache.org/jira/browse/JAMES-2698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16813202#comment-16813202
]
Tellier Benoit commented on JAMES-2698:
---------------------------------------
Hi,
The methods you are refering to are marked as deprecated within the
MailetContext API.
The deprecation message tells: "use the generic dnsLookup method" pointing to a
non implemented metod.
The unerlying data-model, HostAddress is also deprecated.
Obviously, some consistency is required here, we need to implement the
"dnsLookup" method within James.
Regarding the performance considerations you are pointing out, all MX records
can be accessed within a single DNS lookup cf DNSJavaService::findMXRecordRaw.
However you are right to point out addresses are resolved one by one by the
MXHostAddressIterator - which is pre-loading all entries aggressively,
defeating the iterator pattern.
The entire purpose of MXHostAddressIterator seems to be adding the underlying
IP, IP which is use only for logging.
I would consider we seriously need to move away from all these previously
mentionned method and classes. However, as far as I am aware of, DNS resolution
is not a corner case thus overall priority seems low.
Did I answered your questions?
Cheers, and thanks for bringing lights on this code corner... (That was
instructive, at least for me)
> MXHostAddressIterator performance
> ---------------------------------
>
> Key: JAMES-2698
> URL: https://issues.apache.org/jira/browse/JAMES-2698
> Project: James Server
> Issue Type: Bug
> Components: DNSServer
> Affects Versions: 3.4.0
> Reporter: Amichai Rothman
> Priority: Minor
>
> In the old implementation (James 2.3.x) of iterating over the MX records and
> resolving their hosts, e.g. used by MailetContext.getSMTPHostAddresses(), it
> purposely did the lookups lazily, i.e. the hosts for each record were looked
> up only when it was reached by the iteration. The current implementation does
> all the lookups for all records up front and then returns them one by one.
> I don't know if there was a reason for this change or if it was introduced by
> mistake, but it seems reasonable that since these hosts are used to try and
> send messages to the domain, and once it succeeds there is usually no need to
> continue the iteration, that the old behavior would be much more efficient
> and trigger many fewer DNS lookups on average.
> If there is a good reason for the change, it should be documented in the
> iterator, otherwise please return the previous behavior.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]