Score:1

Octopus deployment causes 100% CPU usage in PHP-FPM

bm flag

Environment: AWS
OS: GoldenImage-amazonLinuxV2-2021-01-04_19.43.07
Nginx: 1.20.0
PHP-FPM: 7.3.33
Octopus tentacle: 6.1.1351

The old method
So we currently use a simple push script to deploy a PHP site to 14 AWS EC2 instances. This script simply connects to each server via SSH and runs a git pull in /mnt/web/public_html. After the code is updated the CPU usage remains steady around 20-60%.

The new method
We are trying to switch to Octopus for deployment because it's more robust. The issue we are running into is as soon as the code is deployed to the server the CPU usage skyrockets to 90-100%. This causes a spike in response time and even causes the site to throw 502s. We even let it run for about 2 hours once and it never seems to drop.

CPU usage graph

Pre-deployment script:

if [ "$(get_octopusvariable "Octopus.Tentacle.CurrentDeployment.TargetedRoles")" = "web-server" ]; then
  nginx -s stop;
  sudo systemctl stop php-fpm;
fi

Post-deployment script:

chown -R ec2-user:ec2-user $(get_octopusvariable "Octopus.Action.Package.CustomInstallationDirectory");
if [ "$(get_octopusvariable "Octopus.Tentacle.CurrentDeployment.TargetedRoles")" = "web-server" ]; then
  sudo systemctl start nginx;
  sudo systemctl start php-fpm;
  sudo systemctl status -l nginx;
fi

One thing we tried was disabling Octopus delta compression using the instructions here https://octopus.com/docs/deployments/packages/delta-compression-for-package-transfers

We also tried disabling the purge option here: Octopus install directory

We compared file permissions before and after as well. It seems using the old way git sets folders to 775 and files to 664. Octopus sets folders to 755 and files to 644.

Any ideas would be appreciated.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.