Why is CakePHP 3 so slow at autoloading classes on a Vagrant box? -
setup
- vagrant box (2gb memory)
- apache/2.2.22 (ubuntu)
- php 5.4.38-1+deb.sury.org~precise+2 (cli) (built: feb 20 2015 12:16:47)
- cakephp 3
i installed fresh cakephp 3 composer, , basic default home page noticed page took 4s ~ 5s load. here benchmarks (kitchen.com
server alias):
chrome dev tools
phpstorm + xdebug
even composer.phar dumpautoload -o
didn't change thing.
sometimes rest calls (returning small json) reach ~12s because of autoload , php_sapl_name:
ajax rest call
- request url: http://kitchen.com/admin/kitchen/settings.json
- request method: get
- response:
{ "settings": { "sitename": "site settings", "desciption": "lorem ipsum" } }
- controller action:
public function index() { $this->set('settings', ['sitename' => 'site settings', 'desciption' => 'lorem ipsum']); $this->set('_serialize', ['settings']); }
chrome dev tools , phpstorm + xdebug
so common bug on cakephp 3 or can come server configuration ?
you should make sure have opcode caching enable. in general php performance suffers without opcode caching.
also ensure machine not constrained in terms of io performance. because php applications need load number of files on every request, disk io matters.
i results far typical. typically responses baked code in <150ms on 2 year old laptop cakephp.
edit: re-read question , noticed using vm. shared vm filesystems notoriously slow. if sharing host guest os, see if better performance moving code off of shared filesystem.