Local database access from a Gitpod remote environement (performance)

Hello,

I would like to be able to securely connect to my local database server (MySQL) from a Gitpod workspace. To achieve it :

  • I easily put in place a tailscale connexion between a Gitpod environment (Tailscale x Gitpod or Access your tailnet from Gitpod · Tailscale) and my local machine,
  • Using Gitpod environment variables, I could establish a connexion between my backend (Gitpod env) and my local database server (MySQL on my machine).

Such a configuration is technically working fine but it is actually very slow. Every request is much slower than in real case (direct local database) and I cannnot figure out why.

Does somebody have any experience about such a configuration, and/or would have any idea about the cause of its (very) bad performance and/or any idea on how to investigate it ?

Thank you very much for any help !

Does slow mean:

  • the latency to get results back is 10 milliseconds longer, or
  • it takes 10 minutes to run an SQL query

or something in between?

If the latency just seems long, there are a couple things to check:

  • figure out where the gitpod VM is running, and is it halfway around the planet
  • is Tailscale able to make direct connections? “tailscale ping” from one of the devices to the other will say whether it went through a DERP relay or connected directly.

Thanks for your reply !

It is indeed something between, for example, on one of my apps :

  • a standard request takes 33ms to be retrieved
  • with the gitpod configuration described above, the same request takes about 7000ms.

Tailscale is actually not able to establish a peer-to-peer connexion, but it does not seem to be the cause :
“pong from localmachine via DERP(lhr) in 43ms”

When inspecting this particular request, the TTFB is almost the whole part of the total time, whereas the content dowload is only a few ms.

Could my firewall (or something else from my side) be the cause of this latency ?

Using a database server directly in the gitpod environment does not lead to this latency, everything is ok in this case.

7 seconds is long enough that it seems like something is having to time out before the request proceeds, like maybe a DNS timeout before falling back to some other name resolution.

If possible to run, wireshark or tcpdump on either the gitpod node or the MySQL server may be informative.