I've built a web application with Symfony 3.1 and PHP 7. On my own computer it's running fine, but on the web server it's very slow. Now I want to know why. Not only to have that web app to run faster, but to understand some more about the software itself.
My own computer is has an Intel i7 processor and 8 GB of RAM, running on Ubuntu 16.10. The server has two cores, 4 GB of RAM and runs on CentOS 6.
Comparison between laptop and server
My laptop
The web server:
They are different in terms of both hard- and software, so I don't expect them to be completely the same, but I don't understand why there is a huge difference between them: Symfony initialization is 13x faster, the rendering of Twig templates is 25x faster.
I used the Symfony profiler and Blackfire.io to find out why my application is slow, but that only explains the performance of the application itself. Since the page is a lot faster on my computer, I've to find out why the application is slower on my web server.
IOPS?
I found this blog how to test the disk performance using fio
. I found that my computer performs about 20x better than the server (19.9K/6718 vs 1056 /375 iops). It seems like iops is the bottle neck.
What's next?
One solution is very simple: get a server with better iops performance.
But how do I find out how I can improve my application? Or maybe my web servers' settings? I've installed Opcache and as far as I can see (using this tool), it's working fine.