When running Laravel 5.2 within a PHP-7 docker container I'm getting response times in 300ms - 400ms. That is very slow, if I'm just echoing out phpinfo() on the same container the response time is 12ms - 50ms is anyone experiencing these slow response times?
Okay, problem solved.
On a local development environment using Docker 1.10 with the VirtualBox driver and a volume mounted to the host system (that would be Boot2Docker VM and OSX) the performance is incredibly woeful, as described above 300ms - 600ms.
Use the same configuration without the mounted volumes 20ms - 30ms response times. My assumption is that because Laravel has intensive disk I/O due to the large amount of files it loads on each request this is impacted by how VirtualBox shares folders between the host and a VM.
Issue is not a Docker or Laravel, its a VirtualBox VM issue.
(BTW If you are not using Docker... your crazy.)
UPDATE:
Comparing differing environments in a docker
Note: the below are without artisan optimize --force or artisan config:cache
HHVM with artisan optimisations + unix sockets: 8ms - 12ms
PHP-7 FPM with artisan optimisations + unix sockets: 38ms - 42ms
WOW take a look at HHVM with optimizations and sockets. THAT makes node and golang look slow...
Who needs PHP-7 for performance? not me...
The following optimizations should always be used in production:
composer install -o --no-dev
php artisan optimize --force
php artisan config:cache
php artisan route:cache
Who needs PHP-7 for performance? not me...
In my benchmarks, PHP 7 out performs HHVM LTS on Laravel out of the box. The performance of individual apps could vary though. If PHP 7 is significantly slower, you've probably misconfigured something.
Yes, always running artisan optimisations as above.
I doubt there are any misconfigurations, as both HHVM (v3.11) and PHP-FPM (v7) are running from offical Docker images. If the PHP Docker repos are mis-configured there are no issues logged.
The stats are from a stock Laravel 5.2 welcome route. Isolated Docker environment on Ubuntu.
8 - 12ms is faster then most of my node or golang projects :-)
Turn opcache on for php7 with disabled file check, and compare again ;)
Yeah I will do... I'm about to revisit this
What was your conclusion @andrewmclagan?
Most helpful comment
UPDATE:
Comparing differing environments in a docker
Note: the below are without
artisan optimize --forceorartisan config:cacheHHVM with artisan optimisations + unix sockets: 8ms - 12ms
PHP-7 FPM with artisan optimisations + unix sockets: 38ms - 42ms
WOW take a look at HHVM with optimizations and sockets. THAT makes node and golang look slow...
Who needs PHP-7 for performance? not me...