Node.js microservices - does it make sense to build a service for caching? - microservices

I'm building a microservices architecture with node.js
And I was thinking about an approach that all the caching logic is handled by a separate service does it make any sense?

Related

Third party library management in a microservice architecture

We are moving our monolith to the microservices, and we are looking for a best practice regarding managing third party libraries, e.g: easy update in the case of security problems and so on.
It is clear that the microservices should be independent of each other, still this kind of unity in managing third party libraries would be handy.
Depends on what third party libraries do.
You have some options:
Include the library on your ms if the library is not updated frequently.
Create a new microservice that offers the library functionality. This microservice could be installed as other microservice (on a new pod) or using the sidecar pattern.
For instance, we had a validation library developed to be used with Spring Boot microservices. There was a new customer requirement: we want to develop microservices with other languages. So what we did was create a new microservice that included the validation library and that new microservice was deployed as a sidecar. The requests were validated with this microservice before entering the real microservice with the customer logic.

What is Microservices and is there a connection with MVC

I'm familiar with spring boot framework and I developed an Application which helps to handle online Assignments.I used few service classes to handle different tasks of the application and its structure can be seen here.
And I have seen several complex applications built as independent packages based on the task it do in the application.
(1)
My First question is can my Application be called as a MicroServices Application?? Because I have
used independent services for the application development.
(2)
And my second question is Can a application developed in MicroServices Architecture has MVC Architecture at the same time.But I have seen in several tutorials they are 2 different architectures.But a Moicroservices Application also has Models ,Views and Controllers at the same time.
So can those 2 be used at the same time??
Thank you!!
You should do some deeper research yourself about the concept and theory of microservices. Studying other applications without the basic knowledge can be misleading.
(1) Just because you are using multiple classes called services does not mean, you are building microservices application. Microservice application examples can be - student management rest api, question and answer management rest api, UI for administration, UI for public usage etc. All of them can be separate spring boot apps, or any other technology capable of handling the requirements (node.js, python, php, Asp.net ...) You should be able to deploy, test and use them as separate standalone apps.
(2)I think a microservice app does not need views, it can be a rest/soap app, log aggregation app, health check app, messaging service app etc. But different types can use different architecture, one of which can be MVC.
By definition of M. Fowler microservices are
..an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.
As you see the definition is ambiguous. I think you are building a monolith application with a good separation of responsibilities into classes called XyServices - a possible candidates to migrate to microservices.
Microservices according to Chris Richardson
( recognized thought leader in microservices) is 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
Owned by a small team
The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.
It is way of delivery and based on 12 factors
https://12factor.net/.
We use domain driven design as one of the way.
MVC is way of designing as service where we have model view and controller.
In Microservices architecture we can use MVC in one way where each component will be distributed .
Please go through the Microservice Patterns. It is very good book to understand the Microservices architecture
1.Answer to your question yes your application can be Microservices if it followed the 12 factors as mentioned in the website .
Yes Microservices can be on the pattern of mvc but they will be distributed and like we have Microservices for backend in similar fashion we have micro frontend for UI .

The eurika service is it necessray in implementing a microservice?

I want to create a microservice with spring boot but in fact I am not underestanding the architecture microservice well ! I create a controller, a service, a repository, a model and I have related it with a mongo database thanks to the file application.properties ! And I can access to it thanks to the path "http://localhost:8080".
My question is : This project that I have developped with spring boot is it a microservice ? Or it need the service Eurika to become a microservice ?
Interesting question - to understand the answer you need to think first "Why microservices" or "What are the benefits of microservices".
When you will google this you will get tons of benefits of microservices architecture (of course there are some drawbacks as well).
But focusing on benefits one of the most common benefits you will see is microservices architecture is scalable.
Now the answer to your questions lies in this benefit 'Scalable'.
In very simple words, scalability of microservices means horizontal scalability of the microservices. That essentially means you need to run multiple instances of your microservices so that you can cater more and more load/traffic on your system.
Now the moment you run multiple instances there has to be some support component in your architecture that helps you in service discovery.
And Eureka is one of the ways you do service discovery in the microservices services architecture.
Now the short answer to your question - No! Eureka is not necessary microservices architecture but service discovery is one of the foundation pattern in the microservices architecture. (and Eureka is one of the tool/ways of achieving the same)

Any design practice of a monolith application development for easy transforming to microservices?

To develop a new application for a new business, we are debating whether we shall go for a monolith application or microservices system right now as we don't know how the business will develop in the future. We incline to build a monolith application to start. Any design and development practices of building a monolith application are easy for transforming a monolith application to microservices later?
In terms of technical stack, we are going to use Spring for the back end and Vue for the front end. They can be used for building either a monolith web/mobile application or microservices.

What patterns could I implement in microservice development?

I'm going to begin a new project of microservice and want know about patterns that I might wan't to implement on my new microservice for that I could scale, don't have problems with load balance, have an good service with resilience.
I looking to know about patterns that might microservices should implement
Also could you provide some indications for Java microservices application?
For solve some problems that was said: [1]
Architecture: You could build small microservices as it can be, so that the scale be right focused on need to be.
You could set a Discovery service for registering the applications instances, with that making easier to the client access the right application when are lots of instances of the same service (Netflix Eureka / Spring Cloud).
You could set a Configuration outside the code source of the code, so that all the instances can be configured without human intervention right on the running code (Spring Cloud Config).
Set a way the check the health of the microservice with ease.
I circuit breaker for clear the anomalies microservices instances (Spring Cloud / Netflix Hystrix).
and following as say the Twelve-Factor App.
With lots of another things that you need to that care when building a microservice, suggesting the reading the book, if you'll use Java for building microservices Spring Microservices in Action By John Carnell , if you i'll implement in another programming language this other could guide you, Microservices in Action by Morgan Bruce and Paulo Pereira.
[1] (https://www.amazon.com.br/Spring-Microservices-Action-John-Carnell/dp/1617293989

Resources