I'm new on microservices and I have seen a tutorial(from udemy) where shows technologies like eureka, feign,spring cloud config,hystrix and zuul, but after make some examples I don't understand very well how hystrix monitor and zuul works, In the examples I noticed that hystrix is used by a main application that it access to microservices and in that way I can monitoring my microservices, but with zuul I noticed that it works like a proxy but this is calling the same microservices like the other application, so my question is how can I monitoring the microservices with hystrix if are called by zuul and by the another application, am I need two hystrix monitor or can I have one general?
Thanks in advance.
After read some examples I noticed that zuul is always the start for applications so I can add hystrix monitor to zuul and call the microservices, but I still have doubt about the circuit breaker in use with zuul so I will keep searching.
Related
I have a few synchronous microservices working on production using Spring Boot 2.X version. Soon, we need to implement a gateway if the number of instances of each microservice is going to be increased. I read that Zuul was in a maintenance phase and was replaced by Spring Cloud Gateway which is by default asynchronous technology. My question is, can I still implement Spring Cloud Gateway with my microservices?
Yes, you can use Spring Cloud Gateway without any doubts.
Basically, asynchronous technology means that your resources/threads on Api Gateway won't be blocked waiting for the response from downstream services and that increases a throughput.
Now, once your blocking services complete their internal logic they respond back to Api Gateway using an originally opened connection. Api Gateway in turn responds back to your client.
I search to use spring boot, spring-cloud-gateway, netflix eureka.
Is there anything to do to have a load balancer and circuit breaker for micro-service instance?
I found few information ex ribbon when spring gateway is used instead of zuul.
Actually I have an application for the gateway, another for eureka, another for thymeleaf client
security is not yet choose, probabley jwt
With Spring Cloud Gateway, you can currently use the Hystrix Gateway Filter.
Consider using Hystrix. It is extremely good for microservices and aligns well with Spring cloud stack. Also, take a look at Feign, due to its simplistic approach to communication between microservices and integration with hystrix and ribbon.
The setup:
I have a set of Spring Boot based microservices that are fronted by Spring Cloud Gateway, meaning every request that comes from UI or external API client first comes to Spring Cloud Gateway and is then forwarded to appropriate microservice.
The routes are configured in Consul, and Spring Cloud Gateway communicates with Consul to get the routes accordingly.
Requirement:
There is a need of some microservices communicating with each other with REST APIs. I would prefer this communication to happen via the Spring Cloud Gateway as well. This will help in reducing multiple services going to Consul for getting other service's details.
This means every service should know Gateway's detail at least. And there can be multiple instances of Gateways as well. How is this dealt with in bigger architectures?
Any example that I look up contains one service using Consul, or Gateway using the consul with one microservice. Couldn't understand how to extrapolate that design to a bigger system.
For Example, I have two Rest Api services running
https://my-app-one.com/get
https://my-app-two.com/update
After Zuul API Gateway Implementation the requests will be routed to
Zuul Proxy:
Proxy 1 : https://zuul-api-gateway.com/get
Proxy 2 : https://zuul-api-gateway.com/update
Questions:
Can we implement Hystrix Dashboard at Zuul API gateway level?
Can we utilize all Hystrix commands if implemented at API gateway level?
What are the challenges and please provide documentation or examples.
I already have a working example of Hystrix Circuit Breaker and Hystrix Dashboard. All I want to know is if I can move Hystrix implementation at Zuul API gateway level.
#IMNash: Unfortunately, I cannot comment to your original question so I am afraid I have to ask you via an Answer. I am terribly sorry that I need to do that but I don't have enough reputation points yet.
Is it mandatory for you to go the Zuul way? If not, you might want to consider using Spring Cloud Gateway. The relevant post from Baeldung is an eye opener. See the below snippet:
//...route definition
.route(r -> r.path("/articles")
.filters(f -> f.hystrix("some-command"))
.uri("http://baeldung.com")
.id("hystrix_route")
I have tested this myself and yes, it's that easy to apply Hystrix.
The next step would be to configure the Hystrix filter as per your needs (e.g. timeouts, max semaphores, etc.).
I think we can only implement hystrix at individual rest service level. we can't implement hystrix at zuul routing level.
We have created our application with Spring-Cloud Eureka and Spring-Cloud Zuul with multiple core / support micro services registering to Eureka and accessed via Zuul, everything works fine.
We wanted to collect metrics of the APIs that is accessed via ZUUL.
For example, API - ".../extract" need to know how many times its accessed in 5,15 and 60min time period.
We did some analysis and found various metrics library like Netflix Servo, Dropwiard Metrics, Spring Boot Actuator. Everything points to implementation at the service or API level. We wanted our metrics to be captured at ZUUL itself so that a simple counter is implemented in ZUUL and that would provide us the required metrics. Any suggestion in how to implement this would be helpful.