server reached pm.max_children means a PHP-FPM pool used every permitted child process at least once. It does not prove that the limit is too small. During an active WordPress slowdown, confirm a nonzero listen queue and no idle workers, then use the slow log and request timing ...
Quick answer: A WordPress 504 Gateway Timeout means a gateway, proxy, CDN, web server, PHP process, database, or upstream service did not respond in time. Start with evidence: affected URLs, timing, server logs, PHP-FPM logs, database load, CDN status, and recent WordPress changes. Do not randomly delete ...