Foreman with passenger and apache hang up intermittently

The system was installed with the foreman-installer.
There are about 700 agents managed in the server and most of the agents
refresh their configuration every hour.
About 1-2 hours after the apache server started, the connections to the
server become very slow.
The puppet reports error "Could not retrieve catalog from remote server:
execution expired" and the foreman web page also can't be opened.
This situation usually lasted for several minutes(up to one hour) and then

Version of the modules: