Laravel Wireguard questions

Hi there! I’ve been experiencing some latency throughout my time with fly and it’s been around consistenly 300 MS. I’ve been using namecheap premium DNS and planetscale for my databse.

Would I be getting this latency from wireguard taking time to connect anything? Generally curious, Thanks!

Hi!

Let’s see what we can find out. I have questions to help guide you to answer:

  • Is the latency for HTTP requests being sent to your application?
  • Are you connecting to it via private network addresses, or public addresses? (sounds like public!). If it’s public then wireguard likely isn’t an issue, but let’s see.
  • Where in the world are you vs what region was selected for the app? (is the app in just one region? is the PS database in just one region?)

Generally it would be good to do some work to figure out where the latency is coming from.

For example, maybe you can create a route in the Laravel app that doesn’t connect to the database (be careful of your service providers taking actions against the DB!) to see if the latency improves.

Good to see you as always Chris!

I’ve contacted the planetscale team and they deducted it could be issues with DNS. I was using cloudflare at the time.

My Planetscale database is is ireland / central region.

My project on fly is hosted in london (LHR)

I’m consistently getting 300ms delay from the database boostrapping from LHR to ireland.

I used to have my fly app also in IAD (ashburn VA?) which was having about a 1500ms delay when connecting to a read-only database in ashburn VA from planetscale.

I eventually dropped my read-only and now solely host the application in LHR. Which is netting me about 300MS response times anytime the database is bootstrapping a connection. Tried with or without laravel.

Yes I am purely connecting via http. However I do have an internal networked redis instance connecting aswell but I’m assuming that should look around 1-10ms.

Whats my next step here you think?

I used to use Cloudflare DNS for my project, however I was told their dns seems to be routing incorrectly to some edge instances, for instance I am in New Jersey and it was connecting me to the SEA edge location. From New Jersey to LHR I should be expecting at max 120ms I believe, I think 300ms is a bit more than expected but I am no expert. Thanks for the read and continued support as usual

Hi!

Hmmmm okay, I believe I remember seeing the issue of Cloudflare sending you to some other regions.

OK so it sounds like there’s no longer a read-replica, everything is in LHR, and there’s some latency outside of even PHP…

Maybe I’ll see if I can replicate that speed issue on my end as well (although I’m running out of time today, that may need to wait). I seem to recall seeing something like this before also but I thought it was because I created an app in DFW and was talking to a Planetscale DB in Virginia. Maybe it was something else!

But for other debugging steps, I’m not yet sure. How did youu happen to test outside of Laravel? (another language? Or perhaps you SSH’ed in and just used the mysql command directly?)

I used just raw php no framework to test the actually connection and disconnection and measured that time across 30 seconds or so. However like I stated I now switched of cloudflare and seem to still be experiencing this. I’m not sure if it’s just Planetscale as a whole having higher bootstrap times as I have yet to try Postgres on fly. But I also feel like that would be quite a headache migrating unless you have any resources on that