Skip to content

Conversation

@koosty
Copy link
Owner

@koosty koosty commented Aug 24, 2025

This pull request adds support for TCP connection reuse in the Gatling TCP plugin, allowing users to reuse the same TCP connection across multiple requests for more realistic load testing scenarios. It introduces new configuration options to control connection reuse and keying, updates the core action logic to manage connection lifecycles, and adds comprehensive tests for this feature.

Connection Reuse Feature:

  • Added reuseConnection and connectionKey fields to TcpRequestBuilder, along with new builder methods (withReuseConnection, withReuseConnection(boolean), and withConnectionKey) to configure connection reuse and keying.

Connection Management Logic:

  • Updated TcpRequestAction to check for an existing socket in the session and reuse it if possible, or create and store a new one if not. Handles proper cleanup and removal of connections from the session when no longer needed or on error.

Testing:

  • Added a test case to TcpRequestActionSpec that verifies TCP connection reuse works as expected by sending two requests over the same connection and checking correct session and response handling.

These changes improve the flexibility and realism of TCP load testing by enabling persistent connections and fine-grained connection control.

@sonarqubecloud
Copy link

@koosty koosty merged commit b24530c into main Aug 25, 2025
2 checks passed
@koosty koosty deleted the resuse-connections branch August 25, 2025 13:15
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.

2 participants