I haven't gotten any 504 errors that I can recall, but the entire Fediverse, and even the entire Internet, often comes under attack by things like bot scraping DNS attempts these days.
Here we are not the big boys like Google, Facebook, etc. to swat them aside so easily with our dedicated (and paid) team of expert professional IT support professionals.
These Fediverse instances are more like hobbies, outside of the largest ones like Lemmy.World, so some small amounts of downtime is to be expected.
Edit: the Fediverse Explorer shows uptime stats if you are interested - e.g. PieFed.ca shows 99.63%, which is exactly in-line with the other most populated ones. Hint: sort by decreasing Active Users to see that it is the #3 most popular PieFed instance.