Performance Best Practices Request

Do you have any white papers or suggestions on best practices to maximize performance in the use of the Java Email component? I’m looking for any information and suggestions which may give me insight or performance characteristics of the various Mail objects (MapiMessage and MailMessage) and the PST container.

For example, would it be faster to build a MapiMessage, save it as an MSG or EML file and then, later, which format is faster when adding to a PST container? I realize that performance often comes with various trade-offs like RAM and CPU, but starting with best practices would be helpful.

Specifically we are looking for performance information in these areas:

  • Generation of MapiMessage as quickly as possible.
  • Generation of MailMessage as quickly as possible.
  • Adding MSG or EML files to a PST as quickly and efficiently as possible.

Thanks,

//C


Hi Christopher,


Thank you for writing to Aspose support team.

I would like to share with you that there are no such white papers for the performance comparison as the case may vary depending upon the message size, type and whether using MailMessage or MapiMessage. There are some direct point of impacts that you can avoid to save some time. For example, Saving as an EML file and then converting it to MapiMessage (using MapiMessage.fromMailMessage) will offcourse add an extra operation that can accumulate long delay for a large number of messages. But if the source messages are in EML format, then you have no way to avoid this statement. Thus, it depends on scenario to scenario. Please let us know if we can be of any additional help to you in this regard.

Kashif,

Thank you for the reply.

I noticed that the first email message that I process takes quite a bit of time. So the first time I issue the call new MailMessage() will take about 800-900 milliseconds but subsequent calls to this constructor are near instantaneous. Would you attribute that to the classloader or is the constructor initializing some constructor? I also noticed a similar behavior when saving the Mail or Mapi mail object to disk. The first time I save the email to disk it can take between 3-4 seconds. Subsequent saves to disk take less than 200 milliseconds. Is there some singleton being lazy loaded and if so, is the library threadsafe? I’m assuming it is but I’d like to understand the behavior.

Can I get any additional performance by attempting to add files to the same PST in multiple threads? Or is the PST designed as a single threaded storage container?

Thanks,
//C

Hi Christopher,


Thank you for your inquiry.

Regarding the call to constructor initiation during new message formation and saving, the implementation details are internal to the development team. We have passed this query along with the one related to PST to developers for their feedback and will notify you here once there is some update available in this respect.