The newly installed Laravel only outputs one sentence. Why does it take more than two seconds to return the result?

  question

Laravel needs more than two seconds to return the result when he only outputs one sentence.

The local environment is php7 installed with Docker for Mac, and the laravel version is 5.7

This is the result of a debugbar check.

图片描述

This is the slow log of php-fpm

图片描述

The problem has been solved, thank you.
@to2falseThe answer is correct. The problem lies in the volumn of the Mac. The container on the Mac will request the files of the host for a short delay, while laravel will load hundreds of files even if it only outputs a word. This causes laravel to run for a very long time, sometimes it takes more than 5 seconds to return the results, which is simply intolerable.

The simplest way is to use the cache and add it after the -v parameter:cachedParameters, such as:

docker run --name php71 -d -v /workspace:/workspace:cached php:7.1-fpm

The cached parameter is used to cache the host’s files into a container. The container will use the internal cache instead of the files on the host, so there will be no problem.