Hi there, I made the switch to Fly.io from Heroku recently and am loving it in general.
I ran into a strange issue with Redis today though and can’t quite figure out what might be going wrong.
I have a fairly conventional Rails 7 app set up that makes use of Kredis, which is basically just a wrapper around Redis.
Kredis is connected to one of two Redis Upstash instances I’ve set up for my app (200MB plan, eviction
enabled).
When I run the app locally, I get response times under 1ms:
# Taken from the logs while running the app locally
Kredis Proxy (0.3ms) EXISTS? users:4:show_sidebar
When I run it on Fly, however, that figures jumps massively for the same query:
# Taken from the logs while running the app on Fly
Kredis Proxy (20059.6ms) EXISTS? users:4:show_sidebar
The strange thing is, when I ssh into the app and run the same query manually the time comes back down to a decent level. Not as fast as development, obviously, but fast enough:
User.find(4).show_sidebar.marked?
> Kredis Proxy (26.0ms) EXISTS? users:4:show_sidebar
So, in short, it’s just when I’m using the app in the browser (rather than accessing it from the command line) that the response times become so slow. The Redis instance still returns the expected value eventually, it just takes ~20 seconds to do so.
Hoping someone can help point me in the right direction with this one
Many thanks!