NodeJS vs PHP – a quick performance comparison

NodeJS VS Php

This is not a complete analysis, but only a vision on IT services which I am responsible for my Company. So it cannot be taken as an analytical documentation, but only as an experience on my working field.

I am running many machines with MEAN stack (MongoDB+ExpressJS+AngularJS+NodeJs) on our corporate Amazon AWS cloud servers and some machines based on traditional LAMP stack (Linux+Apache+MySQL+Php). In the latest months the developing effort of the Company was basically phagocytized by NodeJS fixes, with only a very few activities made on Php. We have to consider that now the Company where I work has 6 main softwares and only 2 of them are made on Php.

Normalizing the effort-per-service and leveling their importance and complexity I could find the following differences.


Activities on Php required some hours/man or sometimes minutes to be performed; on the contrary, bugfixings and similar activities on Node required days or weeks/man to be completed.


Building new simple functionalities costed some hours/man on Php, and days/man on Node.

Server performances

Comparing two very similar servers where I run services that should perform in the same way, I could find the following differences. NodeJS server compared with Php server (same type of machine and same amount of average requests per 5 minutes) with installed 2 similar softwares (in terms of activities: DB connections; data elaboration; size of outputs):
The Php machine stays always under 1% of CPU
The NodeJS machine has many peaks over the 5% and sometimes reaches 15% of CPU.

See the attached images

NodeJS machine CPU performances
NodeJS machine CPU performances


Php Machine CPU performances
Php Machine CPU performances


I can conclude only what I suspected for years now: Node is still a technology that is not optimized and is still CPU consuming (and “man” consuming!).

It still needs much more maintenance than monolithic stacks, and also the dispersion of packages (npm modules) and the sometimes useless complications make the work on it much more complicated than on Php.

But this is the direction the World is moving on now, so we need to accept this evil that would be completely unnecessary, but that is growing so fast that you cannot avoid using it. And I have to say: unfortunately!



Php and directory listing

has thousand of useful built-in functions. But it lacks in directory listing. Listing files by creation date can be an awful experience. How can be possible for such a great language like PHP to not have this kind of built-in parameters for scandir or readdir functions? They implemented SCANDIR_SORT_ASCENDING and SCANDIR_SORT_DESCENDING for alphabetical file ordering, but if we want date order we MUST use a custom not efficient array sorting method.

Very bad.