I have a Laravel application that is using a node.js (express) server to server-side render React pages. Both processes are on the same machine.
Currently Laravel sends a POST request to the local node server with some initial data (in JSON) and receives the rendered HTML string from it.
The POST request currently takes 100ms to 200ms, while the rendering itself if performed in an average of 20ms. What are the other 80/180ms being spent on?
I have tried using DNode for RPC, but the latency is comparable.
You've not provided any details of what this is actually running on - what operating system? What is the load on the system?
You've also not said how you measured the the request and "rendering" times.
Unless the delays are occurring in node.js HTTP layer or in some abstraction layer on the PHP side then switching to a different protocol is not gong to help. I think its safe to discount the former - node.js is reasonably fast at serving HTTP most of the time.
In the absence of further information, I'd be running a packet capture between the nodes to see which side the latency is occurring on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With