为什么HHVM比使用Dynamodb Calls的PHP-FPM慢

时间:2014-05-07 14:21:59

标签: php amazon-dynamodb hhvm

我正在评估HHVM,它似乎比PHP-FPM(使用opcache)慢。

这是HHVM的分析结果 http://ldr.io/1nobQyT

这是PHP-FPM的分析结果 http://ldr.io/SzSQmW

我做错了什么? HHVM配置有什么问题吗?

这是我正在运行的测试脚本

include 'aws_sdk2/aws-autoloader.php';

use Aws\DynamoDb\Crc32ErrorChecker;
use Aws\Common\Client\ThrottlingErrorChecker;
use Aws\Common\Enum\ClientOptions;
use Aws\Common\Exception\Parser\JsonQueryExceptionParser;
use Guzzle\Plugin\Backoff\BackoffPlugin;
use Guzzle\Plugin\Backoff\CallbackBackoffStrategy;
use Guzzle\Plugin\Backoff\CurlBackoffStrategy;
use Guzzle\Plugin\Backoff\HttpBackoffStrategy;
use Guzzle\Plugin\Backoff\TruncatedBackoffStrategy;

echo Aws\Common\Enum\Region::NORTHERN_VIRGINIA;

 $config = array (
    'key'    => '',
    'secret' => '',
    'region' => Aws\Common\Enum\Region::NORTHERN_VIRGINIA,
    'scheme' => 'http',
);

 $query = array (
      'TableName' => 'dev_session_sv1',
      'Key' =>
      array (
        'id' =>
        array (
          'N' => '72',
        ),
      ),
      'ConsistentRead' => true,
    );


$a = Aws\Common\Aws::factory($config);
$db = $a->get('DynamoDb');
$result = $db->describeTable(array(
    'TableName' => 'dev_rishabh_sv1'
));
echo PHP_EOL;
echo $result->getPath('Table/ProvisionedThroughput/ReadCapacityUnits');

以下是HHVM配置

Server {
  Port = 9000
  Type = fastcgi
  SourceRoot = /home/ftpcmbin/cm/programs/liger/repo/current/src/htdocs
  DefaultDocument = index.php
  ThreadCount = 15
  APC {
    EnableApc = true
  }
}

Eval {
  Jit = true
  EnableObjDestructCall = true
}
Log {
  Level = Warning
  UseLogFile = true
  File = /var/log/cm/logs/hhvm/error.log
  InjectedStackTrace = true
  NativeStackTrace = true
  NoSilencer = on
  Header = on
  Access {
    * {
      File = /var/log/cm/logs/hhvm/access.log
      Format = %h %l %u %t \"%r\" %>s %b
    }
  }
}

VirtualHost {
  * {
    Pattern = .*
    RewriteRules {
      dirindex {
        pattern = ^/(.*)/$
        to = $1/index.php
        qsa = true
      }
    }
  }
}
StaticFile {
  FilesMatch {
    * {
      pattern = .*\.(dll|exe)
      headers {
        * = Content-Disposition: attachment
      }
    }
  }
  Extensions {
    css = text/css
    gif = image/gif
    html = text/html
    jpe = image/jpeg
    jpeg = image/jpeg
    jpg = image/jpeg
    png = image/png
    tif = image/tiff
    tiff = image/tiff
    txt = text/plain
  }
}
ResourceLimit {
    CoreFileSize = 0          # in bytes
    MaxSocket = 50000         # must be not 0, otherwise HHVM will not start
    SocketDefaultTimeout = 5  # in seconds
    MaxRSS = 0
    MaxRSSPollingCycle = 0    # in seconds, how often to check max memory
    DropCacheCycle = 60        # in seconds, how often to drop disk cache
}

0 个答案:

没有答案