【问题标题】:Laravel lag spikesLaravel 滞后峰值
【发布时间】:2016-06-14 01:04:39
【问题描述】:

当我在 Laravel 中使用 apache 基准测试时,我在随机请求时遇到了一些严重的延迟。 有时会发生错误,告诉我脚本太长而无法运行。

这来自文件:

Vendor\Symfony\Component\Finder\Iterator\DateRangeFilterIterator.php

在这个函数中:

public function accept()
{
    $fileinfo = $this->current();

    if (!file_exists($fileinfo->getRealPath())) {
        return false;
    }

    $filedate = $fileinfo->getMTime();
    foreach ($this->comparators as $compare) {
        if (!$compare->test($filedate)) {
            return false;
        }
    }

    return true;
}

Here is the report

And the report when i set the accept function to return true;

如果我删除该函数并仅通过 return true 替换;滞后停止,但这个功能可能没有什么作用?希望有解决办法,谢谢

【问题讨论】:

    标签: php apache laravel timeout benchmarking


    【解决方案1】:

    听起来文件系统是瓶颈。运行以下命令后尝试运行测试;

    composer dump-autoload -o
    artisan config:cache
    artisan route:cache
    

    他们应该设置一些缓存,这样 laravel 就不会对文件系统造成太大影响。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-24
      • 1970-01-01
      • 2021-02-15
      • 2023-03-25
      • 2015-04-01
      • 2019-02-14
      • 1970-01-01
      相关资源
      最近更新 更多