Add Extended MPTCP (Multipath TCP) Socket Option Support to OpenJDK
Geliang Tang
reviewerDear OpenJDK Maintainers,
We are writing to propose the integration of Multipath TCP (MPTCP) support into OpenJDK. In response to Alan's feedback in earlier discussions [1], we have developed a Java-based implementation that utilizes the setOption method to enable MPTCP before binding or connecting a socket, as illustrated below:
Socket c = new Socket(); c.setOption(ExtendedSocketOptions.TCP_MPTCPIFY, true); c.connect(new InetSocketAddress(loop.getHostAddress(), port));
The name 'TCP_MPTCPIFY' was chosen to align with 'mptcpize' tool in mptcpd and 'mptcpify' in BCC. The complete implementation can be found in [2].
This email outlines the technical background and aims to facilitate further discussion on the proposed approach.
1. Use Cases and Performance Benefits
MPTCP extends standard TCP (as defined in RFC 8684) by allowing the use of multiple paths simultaneously, offering significant advantages:
Seamless handover: Maintain active connections during network
transitions (e.g., as implemented in Apple smartphones since 2013).
Optimized path selection: Dynamically route traffic based on
latency, cost, bandwidth, and other metrics.
Bandwidth aggregation: Combine links (e.g., Wi-Fi and cellular) to
increase total throughput.
Our immediate motivation for introducing MPTCP support in Java is to enable MPTCP capabilities in valkey-java [3]. Valkey - a Redis- compatible key-value database - officially incorporated MPTCP support in its 9.0.0-rc1 release, which reduced latency by approximately 25% under 1% packet loss conditions (see PR [4]).
While the Valkey server (written in C) uses MPTCP natively via the socket() API, most Java clients (including valkey-java) currently lack built-in MPTCP support. As multi-NIC systems become increasingly common, providing Java applications with native MPTCP support is essential for enhancing network performance and reliability.
2. Application Compatibility
A number of applications already support MPTCP natively, as documented on https://www.mptcp.dev/apps.html, including Apache, FreeNginx, and QEmu.
In response to Alan's earlier question regarding enabling MPTCP without modifying applications: the MPTCP community does provide tools such as mptcpize and BCC (mptcpify) to enable MPTCP at the socket level system- wide - for example:
$ mptcpize run java app.jar
However, this method lacks fine-grained control, which becomes problematic when a Java application must use MPTCP and TCP simultaneously - such as one that connects to both Valkey and MySQL. Given this limitation, enabling MPTCP explicitly within the application code remains the most practical and controlled approach, consistent with early MPTCP adoption strategies.
3. Testing
We would also like to initiate a discussion on testing strategies and API documentation for this feature. In [2], we have included a basic MPTCP test. Should this MPTCP implementation be accepted into OpenJDK, we are prepared to develop and maintain corresponding jtreg test cases within the OpenJDK test framework to ensure interface stability. If needed, we - the MPTCP upstream developers - commit to validating this feature in each future OpenJDK release.
We welcome alternative ideas or suggestions on this topic and are open to further discussion. Your feedback on this proposal is highly appreciated.
Best regards,
MPTCP Upstream Developers
References
[1]
https://mail.openjdk.org/pipermail/net-dev/2025-September/027969.html
[2]
https://github.com/openjdk/jdk/compare/master...geliangtang:jdk:master
[3] https://github.com/valkey-io/valkey-java
[4] https://github.com/valkey-io/valkey/pull/1811