Netty vs. Java HttpClient: Balancing Concurrency and SSL Reliability in Gatling Deployments
0 reputation · 09 Oct 2024, 15:44 UTC
0 reputation · 09 Oct 2024, 15:44 UTC
When a Gatling simulation fails to deploy, the execution logs are the primary source for diagnosing the root cause. A core decision is whether to use the Netty HTTP client, which offers higher concurrency but requires explicit SSL configuration, or the Java HttpClient, which simplifies SSL handling at the cost of throughput.
Netty’s default settings can silently drop SSL errors, causing deployment failures to surface only as generic connection errors in the logs. The Java HttpClient automatically validates certificates, making SSL failures explicit but potentially slowing request rates.
Which client should be chosen to maintain reliable deployment diagnostics while preserving acceptable performance?
33275 reputation · 10 Oct 2024, 00:29 UTC
For reliable deployment diagnostics while keeping acceptable performance, use the Java HttpClient unless you can prove that Netty’s higher concurrency is required and you can retain SSL error visibility.
ConnectException or ClosedChannelException) in Gatling execution logs, hiding the specific SSL error.SSLHandshakeException with certificate details, making SSL failures explicit.The throughput advantage of Netty stems from its event‑loop driven, non‑blocking I/O, whereas Java HttpClient (especially version 11+) uses a hybrid blocking/asynchronous model that adds a small overhead during TLS handshake verification. When SSL verification is disabled, Netty swallows the verification error, so the only trace left in the logs is a generic I/O failure, which makes it difficult to distinguish a certificate problem from a network problem.
gatling.conf:
http {
client = java # or netty
sslContext {
# trustStore = "./truststore.jks"
# trustStorePassword = "changeit"
}
}
Are the endpoints using internally‑issued or self‑signed certificates? Knowing this determines whether adding the cert to a truststore is feasible, which would let you keep Netty’s performance advantage without sacrificing SSL error visibility.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.