Is PHP good for any application?
Since php is most popular language on web based applications with a huge amount of opensource components/reusable code and powered by a big community. I think it is important to understand it’s architecture first and then talk about scaling the application.
From my point of view PHP it is one of the best language for a start-up or low budget project because just because of the description above. Maybe I can add more reasons here as: depoyment flow or development efficiency or others.
What if the business grows very fast?
So, what? There are a lot of tricks you can use.
PHP vs HHVM
Since PHP is a interpreted language some use-cases can prove PHP lazy.
HHVM is a opensource project powered by Facebook to add more power to PHP projects. In this way there are few improvements of classical interpreter. HHVM is a just in time compiler for PHP meaning, that the code is not interpreted every time but the generated byte code is saved and reused. HHVM try to resolve few week points as: variable type missing, functions – variables – constants lookup time and others.
The result of my benchmark maybe will surprize you.
The benchmark is made on Magento 1.9, the most popular e-commerce platform on PHP world.
I used basically configured tools and as you can see in the table above just using HHVM you can obtain a 3.5X performance gain then using php 5.6X. But the differcence is not so big if on the standard PHP interpreter you are using APC cache or OPCACHE.
See the performance gain in the following graph
The average response time is much more stable using hhvm because of all optimizations made as you can see bellow.
In my test I used form 15 concurent users up to 250 concurent users, below we can see the availability state of the service during the test.