Skip to content

Add opt-in TLS contention benchmark - #83

Open
mondain wants to merge 1 commit into
apache:2.2.Xfrom
mondain:feature/tls-contention-benchmark
Open

mondain wants to merge 1 commit into
apache:2.2.Xfrom
mondain:feature/tls-contention-benchmark

Conversation

@mondain

@mondain mondain commented Oct 15, 2026

Copy link
Copy Markdown

Summary

Add an opt-in TLS contention benchmark to mina-core. It exercises concurrent writes over one TLS connection and a burst of TLS connections after warmup. The benchmark records JFR jdk.JavaMonitorEnter and jdk.ThreadPark events, prints measured rates and distinct client TLS session IDs, and asserts only functional completion. It does not change production code or enforce a performance threshold in CI.

Run either mode with Java 17 or newer:

mvn -q -pl mina-core -Dtest=SslContentionBenchmarkTest -Dmina.ssl.profile=true -Dmina.ssl.profile.mode=traffic -Dmina.ssl.profile.recording=target/tls-traffic.jfr test
mvn -q -pl mina-core -Dtest=SslContentionBenchmarkTest -Dmina.ssl.profile=true -Dmina.ssl.profile.mode=connections -Dmina.ssl.profile.recording=target/tls-connections.jfr test

Measurements

On one Linux host with Oracle JDK 21.0.3, using loopback TLS 1.2 and JFR enabled, three runs of each default workload produced:

Workload Configuration Observed rate
Concurrent writes 4 writers, 30,000 writes each, 1,024 bytes/write 39.45–46.81 MiB/s echoed
Connections 64 warmup connections, then 384 timed connections 1,317.67–1,354.52 connections/s; one distinct client TLS session ID in each run

For one sample, JFR recorded 40,632 monitor-enter events and 33 thread-park events during the write workload, and 591 monitor-enter events and 44 thread-park events during the connection workload. The recordings are generated locally under mina-core/target/ and are not part of this PR.

Limits and validation

These are short, same-process loopback runs on one host. They include JSSE/provider behavior, allocation, scheduling, echo handling, and JFR collection overhead; they are not production throughput estimates or evidence that a particular lock change helps. TLS 1.2, test key material, and the default JDK random provider are fixed for these measurements. Compare multiple runs on the same host and JDK before drawing performance conclusions.

Validation: both opt-in modes passed in all three measured runs. mvn -q -pl mina-core -Dtest=SslContentionBenchmarkTest,SslFilterScheduledWriteMessagesTest test passed (three tests, zero failures; benchmark skipped by default). git diff --check passed. A separate SslEnd2EndTest run was stopped after more than two minutes because that existing parameterized test sends 4,096 messages for each of two protocol cases; it did not complete in this validation window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant