samedi 13 mars 2021

Designing cluster and non-cluster services in Express

I'm trying to design an Express server that is divided into services. Some of the routes/services should use cluster mode and others not. Cause for some routes 1 thread is enough and they shouldn't block other more important and highly loaded routes. What is the best approach for such servers? Is there any source that demonstrates such design. Also the server handles both http and socket connections.

I've got an idea of creating a Service class and dividing routes by services in separate folders. Then while starting a new service pass its routes index file, isClusterMode property with a boolean value and also connection type(ws or http) as a parameters of the Service class.

I'm little bit confused in the way of organising the Service class.

Thanks in advance for any useful answer.

Aucun commentaire:

Enregistrer un commentaire