Slow connection to DB

We have an astro website with SSG and for each page we pull data from a DB. When building in Netlify, the connection to the DB seems to take 1.3s and each DB query around 200-300ms. The functions region is ap-southeast-1 and our DB is running in AWS ECS in ap-southeast-1 as well. While on the other hand I am physically located in Europe and building the website on my machine I see that connecting and querying the DB takes around 1-2ms. What is the reason for this slow connection?

That sounds unlikely. I am not aware of a database that would revert within 1-2ms. How can we verify this?


You can see on my machine it takes 40ms and on Netlify its 18s

Edit: Okay completely disregard my machine, Im running a local DB :man_facepalming: In any case, where can be the bottleneck on netlify?

Netlify Functions run in the US. That coule potentially add a few hunder millisecods to the latency. But other than that, I’m not sure. This is something you can verify with your database server as to why it takes that long to respond to Netlify.