I am new to fly.io and I have recently deploy a Fly app to production that runs an Express.js server. I am confused with the high latency my API request and when debugging using Fly built-in Grafana dashboard and I found that it’s routing via a region that’s I’m not setting my app to run with (ref image). I have set the instance to run in sin region but the http request is done via ams region.
Hi @pebbletech! My guess is that this is not an issue with your configuration. Rather, it appears that when you connect to Fly.io IP addresses, your internet service provider is sending the traffic to the ams region as opposed to a closer one. Our proxy in ams then has to forward your requests all the way back to the running instance of your app in sin.
(You can also check the fly-request-id HTTP header on responses from your API. The region code at the end of it is the region where your request was received. I suspect that it will be ams.)
Unfortunately, this kind of thing happens with some frequency, but we can sometimes adjust the routing information that we announce to get ISPs to pick better routes. If you’re comfortable providing any information about your location/ISP or sharing traceroute output from your location to your app (like in the first thread I linked to above), we may be able to look into it.
I am currently in Malaysia, Kuala Lumpur and all of my users are in the same region. I am running this traceroute from my ISP “TTNET-MY” (TT DOTCOM SDN BHD) and I suppose majority of my users either using TTNET-MY or TM (https://www.tm.com.my/) .
Here’s the statistic of my app from Grafana for the past 7 days. Most of the traffic still route to HKG and occasionally to SIN and NRT.
SIN is objectively faster compare the other 2 regions but I still wonder why it’s still not routing to this region.
Would be great if you can help us in getting this work with SIN region as latency difference is around 100ms in comparison.
To temporarily worked around this for IPv6, iff your app is not reliant on Fly’s HTTP/TLS handler (proxy), you can setup the DNS AAAA record to point to your Machine’s IPv6 address which doesn’t change across deploys.
fly ssh console -A <fly-private-ip> -a <appname> -C 'printenv FLY_PUBLIC_IP'
Another temporary workaround may be to host Machine in another region closer to the Malaysian peninsula: HKG / NRT / MAA / BOM.