UNSOLVED Fog using a huge amount of memory and failing
I’ve been seeing a lot of sluggishness in the web UI for the past several updates, but didn’t think much of it. I updated to 1.5.3 earlier this week, and the memory usage from Fog is huge, and seems to now be effecting not just the web UI but also the base Fog functions - imaging is slower, tftp connections are timing out, etc.
I’ve assigned the Debian virtual machine that is running Fog 24576 MB of memory, and even with that much it is still trying to use more. Looking in top, apache2 has dozens of processes running and is sucking up all the memory. This is just when the server is sitting idle.
Any suggestions on how to troubleshoot this problem?
I was able to remote in and find out what was going sideways with the OP’s system. I’ll fill out the details in a bit, but there is the keys.
mods-enabled/php5.conf set handler
It appears to be an issue with at least debian 9.4 at the moment where php-fpm wasn’t being enabled causing the sluggish UI and high apache usage.
@jstephen Sorry my mistake same issue and same color avatar.
I don’t think the FOG installer is setting mpm by design. That will help with performance but not using php-fpm will give you a craptacular experience with the new gui.
So you ran the info-php script and its still reporting Apache handler?
@george1421 George, I think I did reply to the proper thread… it is just a little confusing since someone else with a similar problem seems to have popped in!
Fog is version 1.5.4. This same server has been updated through many, many versions for 4 years or mo so maybe it has some lingering old stuff!
My phpinfo page does not indicate that I have FastCGI enabled. I’m reading through this thread ( https://forums.fogproject.org/topic/10717/can-php-fpm-make-fog-web-gui-fast/4 ) now to see whether there is information about getting mpm working.
@jstephen You have 1.5.4 installed, but you have the apache handler in place and you didn’t change it?
If that is true then I can understand why your UI is a bit sucky. That is why they moved to php-fpm. Wait your info.php page showed that you had the fast cgi enabled.
edit: Hint, make sure you are replying to the proper thread.
@george1421 Huh. I’ve got Apache 2.0 Handler here. Should I follow the steps in the link or is there something else that I should do?
I seem to be having bigger issues. PHP is completely un-responsive now. I can and have been able to reach the Apache test page on our server but cannot get anything to run in php. I tried restarting the service, rebooting the server, unistalling php and re-running the fog installer. I will start a new thread and tag you in it.
is probably a close directory for php 7.x in there should be a maybe a /etc/php-fpm.d directory and in that there should be www.conf. The file name is consistent its just the location of the file that changes with the version of php.
Also I added an additional question to my list.
Fog check in interval Fog Configuration -> Fog Settings -> Fog Client -> FOG_CLIENT_CHECKIN_TIME (if you have less than 300 [5 minutes] you might want to bump that up to 300 or 600 seconds).
Top CPU usage service is Apache2.
Total hosts is ~500.
Where is the www.conf file located in Debian? I searched high and low and could not find it. I found something in the /etc/php/7.0/ directory but it didn’t have pm.max_requests.
@joe-gill Can I get to bits of info I forgot to ask?
- Top CPU usage service
- Number of clients you have in your FOG environment
- Fog check in interval Fog Configuration -> Fog Settings -> Fog Client -> FOG_CLIENT_CHECKIN_TIME (if you have less than 300 [5 minutes] you might want to bump that up to 300 or 600 seconds).
Running on a Hyper V Virtual Machine
FOG OS - Debian 9.4
Memory - 4 GB
CPU - 2 CPUs allotted
I used Top to determine these. If their is a better command let me know and I will certainly run that and report back.
Memory Usage (in order from most to least) –
Apache2 (20 percent)
CPU Usage –
@joe-gill Ok you are using php-fpm. That is good. Now we need to understand what is consuming the memory. I had a previous post where I was asking specific questions about your current setup. Please respond to that… and
Depending on your distro there is a php-fpm file that fog creates it should be in /etc (in a sub directory) called
www.conf. Under centos 7 its in
/etc/php-fpm.dLets review that file, towards the middle there should be this line uncommented.
pm.max_requests = 2000
Let make sure its not commented out.
Let me know if their is anything else you would like me to check. Thanks!
@joe-gill ok we need to collect a bit more info here. It sounds like a trend is starting.
- What OS is the host OS for FOG?
- What is your memory installed in the fog server?
- What process is using the most memory?
- What process is using the most CPU utilization?
- Number of clients you have that has fog installed
I actually upgraded to FOG 1.5.4 and the issue persisted.
@joe-gill If you are not on FOG 1.5.4, but are using 1.5.1 to 1.5.3 there is a fix that is needed to php-fpm to address memory bloat under certain conditions.
I have also been experiencing high memory usage and sluggishness. I completely lost my interface and had to restart PHP in order for the interface to return. I will also try your suggestion here to see what is going on.
Yes, 24.5GB of RAM.
Sitting idle, there are 25 apache2 processes using a total of 17% of the available memory. Apache is also using a lot of the cpu percentage as well - 64%.
php-fpm also has about 3 processes, but looks to be taking up only about 1.5% of the RAM.
There has to be something else going on here. These settings are a bit out of wack.
First on the questions I asked you. You might consider 2 vCPUs at 4GB of ram. That is all FOG should use. If you have a 1000 or more hosts then we might need to bump up the numbers a bit.
With FOG 1.5.1 and later FOG now uses pgp-fpm for its pgp engine and moved away from apache’s built in php engine. This should lower the cpu requirements of apache by off-loading php requests to php-fpm. With apache using the majority of the CPU still, it almost sounds like the php activities have not shifted to php-fpm.
What I would like you to do is create a file in the root of the web server directory, typically /var/www/html name that file
info.phpand make it world readable. In that file place the following code:
<html> <body> <?php phpinfo(); ?> </body> </html>
Once its created navigate to that file by using this url
I’m expecting to see a this field set to
and not this
The first screen shows that php-fpm is managing the php process. The second screen is the way fog was setup before version 1.5.1. I would expect php-fpm to have the workload here, not apache.
Wayne Workman last edited by Wayne Workman
@jstephen Try adding the configuration lines to the bottom of this file:
/etc/apache2/apache2.confand then restart apache with
systemctl restart apache2and see what happens. Also, how many cores does your fog server have?
@wayne-workman I added those to mpm_event.conf which seemed like the right place to put them, but I’m not entirely sure!
I can’t really see any difference… maybe it is a tad more stable? What I’ve noticed more than anything with this testing though is that when I restart apache, it runs way, way better for a while. Like this morning, each page in the Fog UI was taking about a minute to load; I restarted apache and it was down to 5 seconds per page even when opening multiple pages at once.