Skip to content

Performance: SMIME signatures slow down batch sending due to excessive keystore loading #320

Closed
@bertm

Description

@bertm

When sending SMIME signed emails, we observe more than 85% of the send time is spent loading the keystore data provided in Pkcs12Config. On our somewhat dated infrastructure (Xeon E5-2670 with virtualization), this boils down to around 400ms of CPU time for every single email. This constrains the send rate on a dual-core virtual machine, regardless of number of executor threads (exceeding 2), to approximately 5 emails per second.

In our case, we use the same signing key/certificate for every email in a batch (size ~200), so loading the keystore over and over is a waste of CPU time.

Key causes appear to be:

  • A new SmimeKeyStore is loaded for every single mail, regardless of whether the same Pkcs12Config is reused.
  • The underlying implementation uses BouncyCastle to load the keystore, which is a notoriously slow provider.

Would you be open to implementing keystore caching, or receiving a patch that implements that (either locally in Pkcs12Config or globally in SMIMESupport)?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions