Facter command slows down when phpunit is started over Jenkins

23 Views Asked by At

I'm having the problem that shell_exec in combination with the facter command is very slow when started over Jenkins. Other commands than facter (like whoami) are fast.

The code runs on a Ubuntu VM that was recently upgrade from 14.x to 18.04.1 LTS. On Ubuntu 14.x I didn't encounter that problem. Facter is currently on version 3.11.3.

I nailed the speed problem down to the shell_exec in combination with facter by using the following code:

<?php

/**
 */
require_once 'AbstractTestCase.php';

/**
 */
class FacterTest extends AbstractTestCase
{

    /**
     */
    public function testSpeedDebug()
    {
        Core_Util_Debug::performanceStart('whoami');
        shell_exec('whoami');
        Core_Util_Debug::performanceEnd('whoami');

        Core_Util_Debug::performanceStart('facter');
        shell_exec('facter hostname');
        Core_Util_Debug::performanceEnd('facter');

        die (PHP_EOL);
    }
}

When started manually over the CLI the output is:

>> name: whoami | time: 0.005261 s | memory: 3.3359 kB RAM
>> name: facter | time: 0.160292 s | memory: 0 B RAM

When started over Jenkins the output is:

>> name: whoami | time: 0.005495 s | memory: 3.3359 kB RAM
>> name: facter | time: 8.652776 s | memory: 0 B RAM

Does someone have an idea why it is slow when started over Jenkins (~8 times slower)?

Thank you in advance.

Extra info: Gave it a quick try on Bamboo, and the behavior is the same as on Jenkins.

0

There are 0 best solutions below