07. Using Hystrix Dashboard

9 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.94
List Price:  €92.78
You save:  €27.83
£55.57
List Price:  £79.40
You save:  £23.82
CA$95.27
List Price:  CA$136.11
You save:  CA$40.83
A$107.88
List Price:  A$154.13
You save:  A$46.24
S$94.55
List Price:  S$135.08
You save:  S$40.52
HK$547.57
List Price:  HK$782.28
You save:  HK$234.71
CHF 63.42
List Price:  CHF 90.61
You save:  CHF 27.18
NOK kr759.63
List Price:  NOK kr1,085.23
You save:  NOK kr325.60
DKK kr484.38
List Price:  DKK kr692.01
You save:  DKK kr207.62
NZ$117.46
List Price:  NZ$167.80
You save:  NZ$50.34
د.إ257.02
List Price:  د.إ367.19
You save:  د.إ110.16
৳7,682.93
List Price:  ৳10,976.08
You save:  ৳3,293.15
₹5,837.41
List Price:  ₹8,339.52
You save:  ₹2,502.10
RM331.26
List Price:  RM473.25
You save:  RM141.99
₦99,285.71
List Price:  ₦141,842.81
You save:  ₦42,557.10
₨19,466.20
List Price:  ₨27,810.04
You save:  ₨8,343.84
฿2,553.28
List Price:  ฿3,647.70
You save:  ฿1,094.41
₺2,262.39
List Price:  ₺3,232.12
You save:  ₺969.73
B$349.43
List Price:  B$499.21
You save:  B$149.77
R1,335.92
List Price:  R1,908.54
You save:  R572.62
Лв126.45
List Price:  Лв180.65
You save:  Лв54.20
₩94,634.34
List Price:  ₩135,197.71
You save:  ₩40,563.37
₪258.03
List Price:  ₪368.63
You save:  ₪110.60
₱3,943.57
List Price:  ₱5,633.91
You save:  ₱1,690.34
¥10,600.67
List Price:  ¥15,144.47
You save:  ¥4,543.79
MX$1,161.53
List Price:  MX$1,659.40
You save:  MX$497.87
QR255
List Price:  QR364.31
You save:  QR109.30
P959.59
List Price:  P1,370.91
You save:  P411.31
KSh9,203.68
List Price:  KSh13,148.68
You save:  KSh3,945
E£3,310.52
List Price:  E£4,729.52
You save:  E£1,419
ብር3,976.27
List Price:  ብር5,680.63
You save:  ብር1,704.36
Kz58,526.41
List Price:  Kz83,612.74
You save:  Kz25,086.33
CLP$68,581.80
List Price:  CLP$97,978.20
You save:  CLP$29,396.40
CN¥506.04
List Price:  CN¥722.95
You save:  CN¥216.90
RD$4,144.87
List Price:  RD$5,921.50
You save:  RD$1,776.62
DA9,443.17
List Price:  DA13,490.83
You save:  DA4,047.65
FJ$158.28
List Price:  FJ$226.12
You save:  FJ$67.84
Q545.87
List Price:  Q779.86
You save:  Q233.98
GY$14,645.83
List Price:  GY$20,923.51
You save:  GY$6,277.68
ISK kr9,762.20
List Price:  ISK kr13,946.60
You save:  ISK kr4,184.40
DH709.20
List Price:  DH1,013.19
You save:  DH303.99
L1,234.28
List Price:  L1,763.34
You save:  L529.05
ден3,991.30
List Price:  ден5,702.11
You save:  ден1,710.80
MOP$564.10
List Price:  MOP$805.89
You save:  MOP$241.79
N$1,325.35
List Price:  N$1,893.44
You save:  N$568.09
C$2,576.69
List Price:  C$3,681.15
You save:  C$1,104.45
रु9,334.54
List Price:  रु13,335.63
You save:  रु4,001.09
S/259.58
List Price:  S/370.84
You save:  S/111.26
K267.89
List Price:  K382.72
You save:  K114.82
SAR262.49
List Price:  SAR375
You save:  SAR112.51
ZK1,765.85
List Price:  ZK2,522.76
You save:  ZK756.90
L322.98
List Price:  L461.43
You save:  L138.44
Kč1,645.46
List Price:  Kč2,350.75
You save:  Kč705.29
Ft25,709.21
List Price:  Ft36,729.02
You save:  Ft11,019.81
SEK kr749.87
List Price:  SEK kr1,071.30
You save:  SEK kr321.42
ARS$60,034.20
List Price:  ARS$85,766.82
You save:  ARS$25,732.62
Bs483.70
List Price:  Bs691.04
You save:  Bs207.33
COP$271,296.95
List Price:  COP$387,583.68
You save:  COP$116,286.73
₡35,581.11
List Price:  ₡50,832.34
You save:  ₡15,251.22
L1,728.07
List Price:  L2,468.78
You save:  L740.71
₲516,441.87
List Price:  ₲737,805.73
You save:  ₲221,363.85
$U2,647.22
List Price:  $U3,781.90
You save:  $U1,134.68
zł280.50
List Price:  zł400.73
You save:  zł120.23
Already have an account? Log In

Transcript

In this session, let us learn about hystrix dashboard hystrix dashboard is used for monitoring the historic status of any application. I am going to work on the same application that we have done in the previous session. Let me first show you the pictorial representation. Now, we had Eureka server and three services, the three service portal service, then you re apply. And then Eureka hystrix. All three are micro services only.

You don't have to give the name of Eureka, Eureka Eureka client, you can have the most proper names like book service Inventory Service order service, like order service, trying to connect to an inventory service to check in for the inventory whether it is available or not. In our case, these are the three services and Eureka is six was trying to connects to Eureka. Eureka client is trying to connect to a hotel service portal. So it's only going to use in the star hotels to Eureka client, which in turn is returning the list to Eureka hystrix. We also had few other methods, all the three are micro services, so they have registered themselves to Eureka server. This part is clear.

Now, what actually I'm going to do is I'm going to monitor the historic status of this particular micro service, because here only we have created the callback method. Now in this case, we have annotated classes at the rate enable circuit breaker. When you run the application, what happens it is born call the original method. If the original method throws an exception, if any of those micro services down are if the database is not available. In our case, we don't have a database, but if the database is not available, in this case, the fallback method will be called Continuously only the fallback method results will be shown in the browser. But in case if the number of requests are more than the threshold, in that case a circuit breaker will open up a circuit will get open.

You can monitor this in the hystrix dashboard. That is what we are going to see here. Now I will go back to my application. So this is the hystrix controller. Here we applied with new hotels, because giving the list of hotels and also getting one hotel by ID when we were trying to solve a flash username, we were getting any error. Eureka client was working fine hotel service was working fine.

Only this particular application was giving an error. It was because of the producers part. I have remoted now it is working perfectly fine. What are the steps? First you need to run Eureka server then water service, then you recognize Eureka hystrix In my case, all the four are running I'll open the console. You can see over here, Eureka server portal service Eureka client and Eureka hystrix.

Now let me go to the browser. So this is the browser showing the registry. Let me refresh it. Here I am getting all the three Eureka client Eureka has six and hotel service. Let us try to open one by one, I'll click 8081 that is hotel service. Here the URL all hyphen hotels.

It is giving me the list of hotels. Again I will come to your a car client. In case of your a car client we had some players hotels only internet is calling hotel service and returning the list of hotels. The same output only. Now we will go into your a QA is fixed in America is six. Now what they will do is I want to call new hotels which will return a list of hotels.

I have got the output here. itself. Let me also show you getting one hotel by ID and checking Hello class username, new hotels slash 127. Now I have got the output. Similarly, let me try this Hello, slash username, it comes off. So all the three services are working perfectly fine.

Now let me open the hystrix dashboard, how to open it with the same URL only localhost colon 8080 slash hystrix. I'm getting the dashboard. Let me copy the same URL. I am supposed to call it using hystrix dot trace, you can just see the URL over here. In this case, we are running only one single single effects application. So the URL is going to be http colon slash slash hystrix app colon port number slash hystrix dot c. So I'm just going to copy it over here with Dr. Ben, click monitor See, you can have a look, whatever method we have called is shown over here, find by ID grid Finder.

Let me open Eclipse, grid, find by Id find all these are the three methods. And again, I will come back to the browser, all the three methods are working fine, whatever the third, the third, you disclose. Now, what I will do was explicitly I am going to shut down one service. Let me shut down Eureka client. I'll go to a clip here. I'll select Eureka client.

I'm going to stop the service. The Eureka client is terminated. You can see over here now, I'll go back to the browser. This is Sarah Do you see let me refresh. Here I bought hotel service and Eureka is six only you a client we have terminated. Now again, I'm going to the 083 slash farmer slash ramp.

Let me refresh. I'm getting the fallback method Can you see the output? Now again similarly, I will give new hotels, I must get the fallback method of course and getting the fallback method, I will go to his fixed dashboard, what has happened you are trying to call the method This is a request, what are the requests the number of requests is very less. So, the circuit is still close Can you see in all the three methods that are to disclose what leaves the number of requests are going more than the threshold level, in that case a search will open. Now, what I will do is I'll try one with one method. So, in our case it is find out that is the URL as new hotels.

So, here you can just see, I'm just refreshing it again and again and again and again. You can do this are you can copy paste it in different browsers sorry different tab. So, here I will refresh continuously. Now, we will see The dashboard. Now still the fact that the number of requests are more can you see this? And again, I will continuously do this.

I'll come back here, I'll refresh this like you disclosed. Now, let me still do it. I have done it a number of times. I'll go back to the dashboard. Now, you can see the circuit is open. So, I refer to as clear, what actually has happened is, we are having a micro service, this micro service is trying to connect to one other micro service, the other micro service is down.

So automatically the showing us the fallback method is the number of requests left it will try to manage it keeping the first to close that is what we have seen, only the fallback method was given to the client, but still the circuit was kept close. But when the number of requests are more going beyond the threshold level, automatically, the circuit opens. Now, we need to clear up again after a predefined text automatically flows. I hope it is clear, this is all about hystrix dashboard. In this case, we are trying to call from one micro service to another micro service is called micro service is not available. In that scenario, the calling micro service has to show a fallback method to decline.

We have seen the results directly in the browser, what actually we can do is we can create a client which is a web application trying to connect to that micro service. So, in the next session, let us see how to call a micro service from a web application. Already you know how to call a RESTful web service from a web application, we are going to follow the same thing only. But in this case, the micro service or the restful service is going to have is fixed attached with itself. If any of the micro service on the floor is not available, it should not throw the exception to the client. Instead it should give the result of the fallback method.

So I will show you a full fledge complete example in the next session, together with height hystrix. Thank you

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.