TIMEOUT GATEWAY ERROR 504

Hi, 

Please advise me what can cause the 504 TIMEOUT GATEWAY ERROR on random pages? I’m struggling with it sice 2 months. The hosting provider told i should optimize my website even though I did (with no results). I disabled all heavy modules, I use cache, boost, aggregation. The website is very slow since the problem occured.

After clearing cache is better. Error occurs more often when cache starts to grow up. 

Website loading very slow – with big size of cache more than 60s!

Any ideas? 

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/22/feed