Is PHP good for any application?
PHP is the 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. And this may be a good reason to consider PHP as one of the best languages for a start-up or low budget project. Maybe I can add more reasons here as deployment 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 an interpreted language some use-cases can prove PHP lazy.
HHVM is an opensource project powered by Facebook to add more power to PHP projects. In this way, there are few improvements to the 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 tries to resolve a few week points as variable type missing, functions – variables – constants lookup time, and others.
The result of my benchmark could surprise you.
The benchmark is made on Magento 1.9, the most popular e-commerce platform in the PHP ecosystem.
I used the default configuration for all scenarios and, as you can see in the table above, just using HHVM you can obtain a 3.5X performance gain over PHP 5.6X. But the difference 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 due to all optimizations made, as you can see below.
In my test, I used 15 concurrent users up to 250 concurrent users and below we can see the availability state of the service during the test.