Error 524 means your host does not respond within the default 100 seconds of timeout.
You can prove it’s not Cloudflare problem by pausing your website on Cloudflare, let all the traffic direct hit your host. If your website still responds slowly, then you need to investigate this issue with your host as Cloudflare is no longer in the picture.