The connection timeout limit between Cloudflare and Kinsta is 185 seconds. If a process or database query takes longer than 185 seconds, you may see one of the following errors:
504 Gateway Timeout
Error 524: a timeout occurred
You can use an application performance management/monitoring tool like New Relic to pinpoint which process or query is causing the timeout error. If optimizing the process or query to complete in less than 185 seconds isn’t possible, your application or database may need more resources.
To scale your application’s resources vertically or horizontally, change a pod’s size or increase the number of pods used for the process.
If the issue is with a database query, you can increase the database’s CPU, RAM, and disk space on the Database Settings page.