Slow initial connection / SSL

Hey, I’ve noticed that most of the latency for the first request to my websites is from the initial connection / SSL.

I ran some tests for the origin https://edge.twocms.com (ignore the statuses)

As you can see most of the time is just waiting for the TLS process.
It’s even slower when a wildcard cert is used (https://test.edge.twocms.com):

Subsequent requests are extremely fast (~50ms in my region), but the TLS part slows down the initial request to ~800ms.

My fly.toml config is pretty standard:

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = false
  auto_start_machines = true
  min_machines_running = 1
  processes = ['app']

[[services]]
  protocol = 'tcp'
  internal_port = 8080

  [[services.ports]]
    port = 80
    handlers = ['http']

  [[services.ports]]
    port = 443
    handlers = ['tls', 'http']

If I use cloudflare to proxy the requests (orange cloud on) then the initial request is faster, but of-course at the cost of subsequent requests being slower because now they have to hop through cloudflare’s servers.

Is there anyway I can reduce this latency?

for anyone else that stumbles upon this, I improved latency by handling SSL myself and getting fly to just forward the encrypted tcp to my machine

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.