简体   繁体   中英

Microservices architecture with node-express

I am planning to use microservice architecture in my project with node- express and this term is new for me.

I researched about it and I came to know that each independent module can be considered as a microservice having a separate database, currently, my project has the same database to all over the module consider below diagram:

Current Architecture:

在此处输入图片说明

All the modules(student, school, faculties) share the same DB and always we need one module table data into another module.

Microservices Architecture: 在此处输入图片说明

Now the problem starts like so we must have the separate DB can't we make three virtual different DB in one DB?

OK if I create three separate DB so can I map one's microservice DB into another microservice for fetching and inserting data and the execution speed will still be boost(as I read that doing separate ms with DB boost your execution speed) as compared to current scenario where I am sharing the same DB and fetching data across the tables in all module?

One question also I have that the big product like OLA, Netflix, Twitter how they are dealing with the microservices if they have different DB and when they want to map the one microservice DB into another microservice?

Please help me out.

Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are

Highly maintainable and testable Loosely coupled Independently deployable Organized around business capabilities. The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack.

From the above explanation the infrastructure is meant to be created in different sections so that when a part of the whole architecture needs to be scaled it can be done independently.We dont need to interfere with the other services.Also if a service is down the whole application doesn't go down. From you example if you create a virtual database in the same database ,and if the database goes down the whole application would do down. Whereas if you deploy the databases separately if the school db goes down the other to db would be up with there services running as well. And also the services should not use databases from other services.

I think there's no need to have different databases for all those modules but rather have each their own REST API that communicates with the same database.

See this answer: stackoverflow.com/a/45421864/7970942

I hope this helps! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM