A
A
Alexander2018-03-04 10:59:07
linux
Alexander, 2018-03-04 10:59:07

Nodejs ssr and microservices, how to prepare correctly?

On implemented 80% on php. There were thoughts to take out frondetnd from the main repository.
In order to structure the code base, implement a declarative style in js, simplify support, lower the entry threshold, and be able to hire more competent and highly specialized developers and other advantages that are significant for the project.
The project is sensitive to SEO, so you need to render the page on the server.
As a result of the restructuring, we get a scheme: The
node on the hit renders the page based on requests to other services. Due to the high number of components on the page, there can be dozens of requests to services. Dozens of http requests to the same services, this is a recurring overhead for initializing connections, checking rights, analytics, etc.
In this regard, the question is how to cook? is it possible to work between the node and php over persistent connections? is it possible to use binary protocols? Is it possible to parallel requests for services, and what profit can we expect?
Does the community have an example of such cases from life, with numbers?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fortop, 2018-03-04
@SpaceMaster1

The node on the hit renders the page based on requests to other services. Due to the high number of components on the page, there can be dozens of requests to services. Dozens of http requests to the same services, this is a recurring overhead for initializing connections, checking rights, analytics, etc.

There are examples. The examples are generally negative.
In the form of an API in php and a front on angular + angular Universal (just your rendering case on the backend side).
This whole thing is buggy. The Middles have not been able to fully cope for more than six months. And the gentlemen poke him with a wand and run away.
And, what is funny, there is no profit as such. Universal itself appeared as an attempt to plug the SEO hole as well.
For structuring your codebase, you're much better off separating page templates from application logic. Microservices are not needed here.
Perhaps your page is generated from blocks, some of which are absolutely static for all users. In this case, splitting into several services is perfect for you, each of which generates its own part, and puts it in the memcache. The end service is only concerned with collecting data from the memcache and processing the part that depends on the end user (for example, personalized news, subscriptions, profile, etc.)
But it would be more correct to perform the analysis considering the specific project structure

I
index0h, 2018-03-04
@index0h

There were thoughts to take out frondetnd from the main repository.

Rendering is on the back, why?
It's not related at all.)
It is possible that your actions will have the complete opposite effect.
If I understand correctly, you don't need a node. PHP was basically created for rendering pages.
I don’t know what kind of project you have, but it’s quite possible that you don’t need microservices either.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question