weixin_39681486 2020-11-22 03:22
浏览 0

Support more advanced batch processing use cases

Simple Java Mail currently uses threads for handling multiple async send calls, but each thread uses its own Session Transport instance. Unless the actual email payload is huge, creating opening Transport connection to the SMTP server takes about half of the time needed for sending the email.

This issue represents three improvements:

  1. Support Transport connection reuse over multiple threads
  2. Implement an SMTP connection pool so we have multiple reusable Transport connections (including lazy / eager initialization)
  3. Take performance to the next level and support clustered SMTP servers, so you can really scale up using multiple SMPT server if your use case requires it.

Solves #198

该提问来源于开源项目:bbottema/simple-java-mail

  • 写回答

6条回答 默认 最新

  • weixin_39681486 2020-11-22 03:22
    关注

    To support all these features, I'm looking for a thread-safe Generic Object Pool. My requirements are:

    1. Small code base
    2. Flexible enough to support eager / lazy object initialization and auto-expiry policy
    3. Simple to understand, so I can debug issues myself
    4. Up to date, active maintainer / community
    5. Good documentation, well tested
    6. High performance is nice but of secondary concern since my current use case is an SMTP connection pool

    I started out with Stormpot as object pool to implement a new SMTP connection pool library, but it is not flexible enough for this use case (and frankly too opinionated). And really the code is... not how I would like to support it (complicated, custom DSL). That on top of code that is already complex due to performance optimizations.

    I now started a new generic object pool which was originally inspired by the old and inactive KBOP but turned out to be a complete rebirth. It shaping out nicely currently so I'll be re-implementing the SMTP connection pool shortly. I'll add project links later on.

    I've already implemented the SMPT Connection Pool API and Cluster support in separate (micro) libraries and integrated it in Simple Java Mail, I just need to reintegrate it with the new generic object pool.

    评论

报告相同问题?