Apurva Singh
Apurva Singh

Reputation: 5000

Want to run a dozen microservices on a single machine

I have a 16 core 64 gig server. I am using node.js for microservices based architecture. There are about a dozen microservices. Seems good fit to deploy all dozen microservices on the same machine.
Usually people debate between REST vs Messaging, and messaging usually wins. In this scenario, both appear an unnecessary overhead.
How should the microservices communicate.. say, using node js, or JVM based processes. Ideally, best performance would come if each microservice is "bound" to a core, and communicate with others using L2 or L3 cache! Superfast. Is it possible to do that?

  1. Bind microservice process to a core forever
  2. Microservices communicate using L2 or L3 cache Thanks

Upvotes: 1

Views: 5599

Answers (2)

Tonto
Tonto

Reputation: 3102

Using containers to host your microservices on one server can work well. You can follow this link to learn more 3 Reasons why you should use containers to run microservices

Upvotes: 3

Momen Zalabany
Momen Zalabany

Reputation: 9007

May I ask why would you bother build a distributed system when you are not going to distribute it at all ?

Way people use messaging que or rest is to decouple each micro service into its own webserver, this way you can deploy them to multiple servers and they still act as one unit and communicate just fine.

In your case, why would you bootstrap nodejs server a dozen times when all your code is next to each other ?

Yes you are correct it would be super fast to use cache to communicate, many ppl use redis for this.

Yet since all your code is in same place wouldn't a single function call be even faster ?

I recommend for you.

Change your app into single server. Communicate your Models in this case using function calls.

Whenever you are ready to deploy to cloud distributed env. Then split am back again.

Upvotes: 7

Related Questions