How much performance decreases node.js when you run it through the php function exec()?

Hi, I want to organize server-side rendering on laravel+vue.js
Caught my eyes like this package https://github.com/spatie/laravel-server-side-rendering
In General, everything is convenient, but confuses one moment - the package is in fact at every boot starts
<?php $result = exec('/usr/local/bin/node file.js')
that is node.js not hanging like a server, and each time it is restarted.
Tell me how much it may affect performance? What pitfalls can I expect? Whether it is necessary to communicate with it?
March 19th 20 at 08:30
4 answers
March 19th 20 at 08:32
Solution
time node-p '(process.memoryUsage().heapUsed/1048576).toFixed(2)+"M"'
runs on your server and admire the overhead from running bare nodes...
I have (Noda v10.15.3) here it is:
3.71 M

real 0m0,076s
user 0m0,064s
sys 0m0,012s


now let's throw in work vue-ssr, which is not just recommends to install the cache...

in General, think for yourself, how the overhead to wait 100-200ms on and spend ~5MB on seopros
March 19th 20 at 08:34
exec runs an external program. The performance of the nodes does not change.
Depending on how you run the render, but in General, a node should not hang a server, it renders all of one time and ends, it's just a script.
Although if you on everyone will rerendering the whole project, this is clearly not the best solution.
But to render when the source data changes, this is normal.
March 19th 20 at 08:36
+0.1 s on average, due to the long start-up v8 and it's a lot.
March 19th 20 at 08:38
And you are sure that this process runs each time a request to the server and not recompiled once changes as view function larabel?
Yes, every time renders - otilia22 commented on March 19th 20 at 08:41

Find more questions by tags Server-Side RenderingNode.jsPHP