For example, I ran that analyze query from the job on one hiveserver.
Then opened one other connection to the same hiveserver and Executed "show databases" command. It took 492 seconds (8.2 minutes) to get the response.
Is the following jira relevant: https://issues.apache.org/jira/browse/HIVE-13374
The jira could be relevant as the slow response usually points to java heap memory issues. But better if you can check the hive server logs and see if any 'outofmemory' errors show-up there. It would be better if you can post log errors here (if any present) for further analysis.