Bizzarely slow first deploy for a rails app, and slow external api calls

Hi! I’m messing around with with a small hacker news client built in Ruby on Rails. It’s a completely standard rails 7 app, and I’m using exactly the dockerfile + fly.toml that flyctl generated.

Though deploying took about 80min, which was entirely dominated by installing gems very slowly. Then once deployed, it seems like the network requests I have to call out to the hacker news api (example: take about 1minute on average.

I’ve tried it on a few different regions with the same results. Is there something I should be configuring here?

That is very slow. Can you run fly ssh console to connect to your app, then run this and see how long it takes?

time curl -o /dev/null -sS

Also try this and see if there’s a difference:

time curl -o /dev/null -sS --ipv6

Are subsequent builds faster? Pulling ruby gems sounds extremely slow, but your Docker layers should be cached when you run fly deploy again.

So interestingly, I never seem to get a response from the ipv6 connection (^C after 1:45)

Capture d’écran, le 2022-07-10 à 13.05.06

So that seems to give a pretty clear picture of what’s going on! Trying from my own machine, the connection drops instantly. So the service doesn’t even support responding to ipv6 connections I assume. That wasn’t even something I was considering. I’m just calling endpoints using a Net::HTTP wrapper.

For the ruby gems issue, yes, that’s only on the first deploy, but it seemed odd. A fresh bundle install on my machine takes under 30 seconds.

Try running fly regions set yyz and see if the app itself behaves better.

This could be the same problem, it seems like something is acting weird with IPv6 in Montreal. We’re investigating.

Oh yeah the toronto region works! Odd I had tried yyz last night and was seeing something similar but this seems to be working perfectly now.

Thanks! And have a good rest of the weekend!

No problem! It’s quite possible you tried toronto, but it didn’t actually move the VM there. The UX for this is a little confusing. If you do see a similar issue in another region, let us know. You can verify where your app is running with fly status.

1 Like

We discovered the cause of ipv6 not working properly in the yul (Montreal) region was due to some initial server provisioning errors that weren’t fully resolved. We’ve gone through all the hosts there to fix up the problems and it should all be working as expected now.