Reputation: 343
I'm studying the micro-services concept. I did a small demo & understood the difference between monolith & microservice application. (the architectural difference too. cool!) Demo: Used spring-boot, Eureka, spring-cloud which uses the Client Side Service Discovery.
I also tried to understand the Client-side vs. Server-side service discovery. And later I struggled and found it difficult to understand the technical difference between... the API invocation from a monolith app. and the microservices invocation from another microservice application. (like what actually happens beneath/behind the curtains)
For Instance, Consider the following API from a monolith app. which can be consumed from another monolith app./micorservice
A) GET API: http://127.0.0.1:8080/projects as traditional REST API its what I know & what we expect.
Consider this API which is from a microservice application (say, a Eureka Client)
B-initial) GET API: http://localhost:18082/products that was later transformed into for the service discovery purpose usage
B-new) http://product-info-service:18082/products
So from what I observe, the Eureka Server contains these service names in its service registry. Whenever any registered Eureka client requests for the above microservice with its specific "service-name", the eurekaServer does a lookup, resolve if it finds perfect match & forwards the request, the request gets processed.
My Concern: So Is it, all the same, happening internally here? be it monolith or microservices? I mean, does the discovery server in the microservices internally invokes a specific microservice just like an API? OR does the monolith API invocation differ from the microservice service invocation? Or it's just an abstraction.
PS: still learning, apologies in advance If I've made mistakes while asking anything vague or confused things here. Please correct me. Thanks
My git-hub link: https://github.com/aniketrb-github/microservices Content that I'm following from is JavaBrains
Upvotes: 2
Views: 408
Reputation: 711
You're correct, it's really just an abstraction and decoupling of services. The only thing you are introducing is another API request. In A, you have client -> projects
whereas in a microservice architecture you have client -> api-gateway -> projects
. This means you've now created a distributed system, which has many pros & cons (as does a monolithic architecture).
Overall, it's essentially doing the same thing, returning a list of products. It's just getting the list of products from another service, rather than from inside a monolithic application. Eureka is being used to discover where the other services are, so it knows where the microservice is in respect to your gateway application.
For the future, you'd want to start learning about fault-tolerance and other aspects of running a reliable microservice architecture.
Upvotes: 1