Questions
Hosting questions, answered straight.
Short answers first, then the trade-offs and the tool for your next step.
Troubleshooting
How does a 504 differ from a 502 response?
A 502 means a gateway received an invalid response from an upstream server. A 504 means the gateway did not receive a response in time. Both point to the link between proxy and upstream, but the likely checks differ.
TroubleshootingWhat does 502 Bad Gateway mean?
A 502 response means a gateway or proxy received an invalid response from an upstream server. Find which component returned it, then inspect its connection to the upstream and the matching application logs. The status alone does not identify the root cause.
Rather work it out with numbers?
Plan VPS resources, calculate real monthly cost or check how much memory a model needs.