Edition 0 Updated to asp. Net core 0



Yüklə 11,82 Mb.
Pdf görüntüsü
səhifə271/288
tarix12.07.2023
ölçüsü11,82 Mb.
#136458
1   ...   267   268   269   270   271   272   273   274   ...   288
NET-Microservices-Architecture-for-Containerized-NET-Applications

//
Configuration
{
"HealthChecksUI"
:
{
"HealthChecks"
:
[
{
"Name"
:
"Ordering HTTP Check"
,
"Uri"
:
"http://host.docker.internal:5102/hc"
}
,
{
"Name"
:
"Ordering HTTP Background Check"
,
"Uri"
:
"http://host.docker.internal:5111/hc"
}
,
//...
]
}
}
Program.cs
file that adds HealthChecksUI: 


318 
CHAPTER 7 | Implement resilient applications 
// Program.cs from WebStatus(Watch Dog) service
//
// Registers required services for health checks
builder.
Services
.
AddHealthChecksUI
(); 
// build the app, register other middleware
app.
UseHealthChecksUI
(config => config.
UIPath

"/hc-ui"
); 
Health checks when using orchestrators 
To monitor the availability of your microservices, orchestrators like Kubernetes and Service Fabric 
periodically perform health checks by sending requests to test the microservices. When an 
orchestrator determines that a service/container is unhealthy, it stops routing requests to that 
instance. It also usually creates a new instance of that container. 
For instance, most orchestrators can use health checks to manage zero-downtime deployments. Only 
when the status of a service/container changes to healthy will the orchestrator start routing traffic to 
service/container instances. 
Health monitoring is especially important when an orchestrator performs an application upgrade. 
Some orchestrators (like Azure Service Fabric) update services in phases

for example, they might 
update one-
fifth of the cluster surface for each application upgrade. The set of nodes that’s upgraded 
at the same time is referred to as an 
upgrade domain
. After each upgrade domain has been upgraded 
and is available to users, that upgrade domain must pass health checks before the deployment moves 
to the next upgrade domain. 
Another aspect of service health is reporting metrics from the service. This is an advanced capability of 
the health model of some orchestrators, like Service Fabric. Metrics are important when using an 
orchestrator because they are used to balance resource usage. Metrics also can be an indicator of 
system health. For example, you might have an application that has many microservices, and each 
instance reports a requests-per-second (RPS) metric. If one service is using more resources (memory, 
processor, etc.) than another service, the orchestrator could move service instances around in the 
cluster to try to maintain even resource utilization. 
Note that Azure Service Fabric provides its own 
Health Monitoring model
, which is more advanced 
than simple health checks. 

Yüklə 11,82 Mb.

Dostları ilə paylaş:
1   ...   267   268   269   270   271   272   273   274   ...   288




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin