Setup
I just installed a fresh CakePHP 3 with composer, and with the very basic default home page i noticed the page took like 4s ~ 5s to load. Here are the benchmarks (kitchen.com
is the server alias):
Chrome Dev Tools
PhpStorm + Xdebug
Even composer.phar dumpautoload -o
didn't change a thing.
Sometimes some REST calls (returning small json) could reach ~12s because of the autoload and that php_sapl_name:
Ajax REST call
{
"settings": {
"sitename": "Site settings",
"desciption": "Lorem ipsum"
}
}
public function index() {
$this->set('settings', ['sitename' => 'Site settings', 'desciption' => 'Lorem ipsum']);
$this->set('_serialize', ['settings']);
}
Chrome dev tools and PhpStorm + Xdebug
So is it a common bug on CakePHP 3 or it can come from my server configuration ?
You should make sure that you have opcode caching enable. In general PHP performance suffers greatly without opcode caching.
Also ensure your machine is not constrained in terms of IO performance. Because PHP applications need to load a number of files on every request, disk IO matters.
I would say you results are very far from typical. I typically get responses from baked code in <150ms on my 2 year old laptop from CakePHP.
Edit: I re-read your question and noticed that you are using VM. Shared VM filesystems are notoriously slow. If you are sharing from the host into the guest OS, see if you get better performance by moving your code off of the shared filesystem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With