postgres-db and service app has a latency of 30 ms while in same region

Why do I see a latency of 30ms while my Postgres-db and the service app are ins the same region?

Hi,

How are you measuring latency in this case? Which region are your services located in?

  • Daniel

Hi Daniel, I have a Coder deployment, and it has a built-in health page that measures it for me. Both Coder and Postgres are deployed in ams region.

Here is a related issue: healthcheck: configurable database delay · Issue #9381 · coder/coder · GitHub

I am following this guide with the exception of CODER_EXPERIMENTS=* to enable this experimental health page.

Atif

Hi, can you double-check that coder was deployed to ams?

fly machines list --app coder would do it, the region column will tell you where it is.

The latency suggests it’s in a different region so let’s rule that easy one out first.

  • Daniel

Thanks Daniel, I checked, and it looks like coder is hosted in arn while coder-db is in ams

fly machines list --app coder
1 machines have been retrieved from app coder.
View them in the UI here

coder
ID            	NAME                    	STATE  	REGION	IMAGE                   	IP ADDRESS                    	VOLUME	CREATED             	LAST UPDATED        	APP PLATFORM	PROCESS GROUP	SIZE
4d891141f56487	solitary-wildflower-7813	started	arn   	coder/coder-preview:main	fdaa:1:9419:a7b:e9:cef3:34a0:2	      	2023-05-05T04:44:17Z	2023-08-28T17:47:52Z	v2          	app          	shared-cpu-1x:512MB

fly regions set ams --app coder
Region Pool:
ams
Backup Region:

Also, my fly.toml looks like this,

app = "coder"
primary_region = "ams"

[experimental]
  auto_rollback = true

[build]
  image = "ghcr.io/coder/coder-preview:main"

[env]
  CODER_ACCESS_URL = "https://coder.fly.dev"
  CODER_HTTP_ADDRESS = "0.0.0.0:3000"
  CODER_EXPERIMENTS = "*,moons"
  CODER_TELEMETRY_INSTALL_SOURCE = "fly.io"
  PRIMARY_REGION = "ams"

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0

So I wonder why it is not in ams?

Atif

You might have scaled to 1 unit in arn at some point and removed the ams instance. You can add a unit in ams and remove the arn one if you don’t need it.

  • Daniel

How would I do that? fly regions set or fly regions add doesn’t seem to work for V2 apps.

I was able to move my app to ams regions by,

  1. fly machine clone --app coder --region ams
  2. fly machines destroy --app coder --select --force to destroy the machine from arn region.

Thank you!

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