Reducing Latency with WS Client

Using play-ws with play 2.8.2 with wsClient to connect to a backend listening on https port. This service specifically does not require client certs so ssl-mutual-auth is not necessary. Occasionally we see a spike in production so I was looking to see if changing the config in application.conf could achieve faster processing. {
ssl {
debug {
all = true
useragent = “toranws”
ssl-config.loose {
acceptAnyCertificate = true

I cannot deploy this to prod but see that with tracing enabled, it is still creating SSLEngine and despite getHandshakeStatus() returning NOT_HANDSHAKING, it is still showing beginHandshake() and also attempts several getSession() with different ciphers. Is there a way to further reduce this overhead of SSL?

I have attached the logging output is here:


what sort of latency are you seeing?

I’ve used WSClient in multiple environments and systems (local development on Macs, in Microsoft Azure AppService, in AWS BeanStalk and AWS Fargate, etc). I’ve never experienced any issue with latency and in all the production environments, the APIs being called have been over TLS.

Right now I have a Play frontend instance running in an Azure AppService docker container. Play makes API calls over TLS against a SpringFramework-based microservice (running in a different docker container) on Azure AppService (and which in turn connects to an Azure MySQL database) complete in under 80ms.

I’d recommend creating a WSClient request filter that measures the time between outbound request/response. If you publish the timings to a service like amplitude, mixpanel, azure monitor, google analytics, you’ll quickly see what your average response timings look like. granted this doesn’t show you the TLS handshake time.